How To: Stop Windows 10 from sleeping after a few minutes of inactivity

PC on? Make a coffee? PC sleeping when you return? Infuriating… I’d already fixed this once after hours of googling, then installed some updates and it’s back to doze-town should I not constantly pay attention to the machine. Here’s how to fix it:

  1. Launch regedit as Administrator (right-click “Run as administrator”).
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0
  3. Double click on the Attributes key give it the value 2.
  4. Go to Advanced power settings (click on Windows button, write “power options”, click on “Power & sleep settings”, in the selected plan click on “Change plan settings” then “Change advanced power settings”.
  5. Find the Sleep | System unattended sleep timeout option then change the value from 2 Minutes to 20 minutes or such (or indeed 9999).

Source: http://www.tenforums.com/performance-maintenance/17899-monitor-turns-off-after-2-minutes-inactivity-3.html#post441903

How To: Disable laptop lid open / close events on any Linux using systemd

Edit /etc/systemd/logind.conf and change the HandleLidSwitch to the following:

Then you could try to restart the systemd-logind service with:

BUT it crashed my machine when I did, so perhaps just a reboot for it to take effect would be the best option.

How-To: Fix IntelliJ / Android Studio screen display corruption

With my NVidia 980M w/ Optimus graphics card, Android Studio (which is IntelliJ-based) would often get itself in a state and the screen would get corrupted, which was incredibly frustrating to work with. Luckily there seems to be a pretty simple solution:

1 – Find your user folder

If you want to make this change on a per-user basis, then you’ll need to create a vmoptions file in the relevant user-directory. I’m doing this fix on Windows running 64-bit Android Studio so I’ve created the file: %USERPROFILE%\.{FOLDER_NAME}\studio64.exe.vmoptions

Depending on your operating system, the filename and locations are:

Windows:
%USERPROFILE%\.{FOLDER_NAME}\studio.exe.vmoptions and/or %USERPROFILE%\.{FOLDER_NAME}\studio64.exe.vmoptions

Mac:
~/Library/Preferences/{FOLDER_NAME}/studio.vmoptions

Linux:
~/.{FOLDER_NAME}/studio.vmoptions and/or ~/.{FOLDER_NAME}/studio64.vmoptions

Where FOLDER_NAME is something like AndroidStudio1.5 or such.

If you want to make the change on a global basis (although the config file doesn’t recommend this), then you can modify the studio.exe.vmoptions configuration file in the bin folder located wherever Android Studio is installed (on Windows this is likely to be “Program Files” for 64-bit or “Program Files (x86)” for 32-bit Android Studio). So for me the ‘global’ config file is: C:\Program Files\Android\Android Studio\bin\studio64.exe.vmoptions

Source: http://tools.android.com/tech-docs/configuration

2 – Add this switch

Save the file then restart Android Studio and the display corruption should be fixed!

Source: http://stackoverflow.com/a/27768329.

Wrap up and secondary workaround

This worked fine for me in Windows, but as the settings affect Direct3D, I’m somewhat doubtful that it’ll work in Linux or Mac. However, I did read about a workaround technique where you go into the NVidia Settings panel, select your java runtime and force it to always work in maximum performance mode, thus bypassing any use of Optimus which may also be causing the screen corruption – so should the above fix not work for you, then perhaps the workaround will.

Cheers!