I can't get no sleep
- 3 minutes read - 481 wordsTips & tricks …
… plus a few reminders for things I often need to look up
What are the symptoms?
Well, it’s not a bad as the Insomnia by Faithless lyrics, but it is annoying.
Over the last couple of months I’ve noticed my Windows 11 machine not showing my wonderful screensaver after being idle for the configured number of minutes. Rude. And like any really annoying issue, it only does this intermittently.
Now you could say “well, it’s not the end of the world”, and you’d be right. Screensavers and auto-sleeping displays are not as necessary as they used to be. LCD and LED displays are not as prone to screen burn-in as the old CRT monitors.
But that’s not the important part. What comes with this “sleeping” is an auto-lock of your desktop, thus requiring you to unlock it (with your face/PIN/password/etc) when you return. Now, you should always lock your device when leaving it but this at least acts as a back-stop, if you forget.
So what’s keeping my machine awake?
A bit of Googling landed me on this command, which you need to run from an elevated prompt:
powercfg /requests
From the docs:
Enumerates application and driver Power Requests. Power Requests prevent the computer from automatically powering off the display or entering a low-power sleep mode.
For example, when I have a Google Meet open in Chrome it shows this:
This is fine and expected. Google Meet is playing the meeting audio, so those drivers are in use, and it is running in Chrome, so that has some WebRTC stuff going on too. All seems reasonable - you don’t want your machine going to sleep when you’re in a meeting.
After closing Google Meet I get this output:
Nice. Now I can see what might be keeping my machine awake.
So what was the culprit?
For me, it was Slack.
Slack was running, but I wasn’t doing anything with it at the time. Blink Wake Lock
. Intriguing…
I knew that the Slack desktop app uses Electron so it uses web technologies underneath.
Wake locks are part the API supported by browsers to request a lock that prevents device screens from dimming or locking when an application needs to keep running.
And Blink is the rendering engine used in Chromium-based browsers.
2 + 2 = 4
So, I assume, occasionally Slack goes a bit wrong and leaves one of these wake locks hanging, thus preventing my machine from going to sleep or displaying my lovely screensaver.
The fix?
Uhem, … , turn if off and turn it back on again. Slack that is, not the machine. Not a permanent solution but not a big deal either.
Hopefully this post can help out other folks who see insomnia in their machines.
Final note
There are all sorts of command-line options for powercfg
, so investigate the docs for yourself.