I recently installed Elementary OS Juno (my preferred flavor of linux because of it's simplicity, good looks, and ease of use) but was having a problem that when I left the computer for too long it would freeze up when I unlocked it. Certain windows would respond to mouse input but the top bar does not respond and neither did any system keyboard shortcuts such as Super+Space to open the applications menu. Chrome would also not respond although Firefox would which is strange. I noticed that the HDDs were spinning up after a long time away which I take as an indication that is has gone into some sort of sleep mode even though I used any and all system settings to ensure that the computer never sleeps or hibernates. After some googling I found this as a possible solution:
Edit /etc/defaults/grub:
GRUB_CMDLINE_LINUX_DEFAULT="intel_idle.max_cstate=1"
Then run:
update-grub
shutdown -r now
The jury is still out on whether or not this is working 100% of the time as I don't often leave my laptop idle for long periods of time but so far I have not noticed the freezing issue.