Skip to content

AFKLocker 0.4.1

Choose a tag to compare

@github-actions github-actions released this 07 Sep 11:47
· 6 commits to main since this release
1a612e1

Locking now turns your screens off, and keeps them off when you close the lid.

The bug

Locking did not darken a screen. AFKLocker locked the session, exited, and left the display to Windows' console lock display off timeout. That setting is sixty seconds by default, it is hidden from powercfg /q, and on some machines it never fires at all. Lock, walk away, and the lock screen could sit there glowing — on an external monitor, in full view of the room you just left.

Closing the lid did not save you either. It makes Windows reconfigure the displays, and that reconfiguration wakes the external monitor back up. It happens after the lock, so anything AFKLocker did at lock time had already been done and lost.

The fix

AFKLocker now asks for display-off right after locking, and holds it for up to 45 seconds — long enough to cover locking and then closing the lid. The request puts the panel into standby rather than painting it black, which is the difference between a monitor that is off and one that is merely dark.

The hard half is knowing when to stop, because a program that insists would blank the screen of somebody standing at the machine typing their password. Any one of these ends it immediately:

  • the session is unlocked
  • a key is pressed or the mouse moves
  • the lid is opened
  • five requests have been made, meaning something else on this machine wants the display on and gets to win
  • 45 seconds pass

Then the process exits. Every ambiguous case fails towards leaving the display on.

This applies to both modes now. Manual mode previously never touched the display at all.

Honest note about the first attempt

The first version of this hung. It tore its own notification window down from inside that window's message handler; the teardown failed, the "finished" event never fired, the process never exited — and because it held a single-instance lock, every later lock skipped blanking without saying a word. It worked once, then silently stopped working.

Fixed three ways rather than one, because a silent failure deserves more than a single guard: the teardown is deferred to the next turn of the message loop, "finished" is raised before any cleanup so nothing depends on cleanup succeeding, and the single-instance lock is gone entirely. Two blankers briefly asking for the same thing is harmless; a silent opt-out is not. A watchdog ends the process regardless.

What did not change

AFKLocker.exe now lives for up to 45 seconds after locking instead of exiting immediately. It still holds no execution state, starts no service, and never keeps the machine awake — the power configuration does that, as before. The lock is complete before any of this begins and nothing here can undo it. No display timeout is ever written to your power plan.

Verifying this download

There is still no code signing certificate — a recurring cost this project does not have — so SmartScreen will warn on first run. You do not have to take the download on trust:

# Proves these exact bytes came from this repository's release workflow
gh attestation verify AFKLocker-0.4.1-setup.exe --repo augbastos/AFKLocker

Or check the hash against SHA256SUMS.txt below.


Verified on one laptop with an external monitor: four lock-and-close-the-lid cycles, four screens that went dark and stayed dark, no process left behind. Everything else is covered by tests against simulated machines. If it does not work on yours, AFKLocker Setup → Diagnostics → Export diagnostics produces a file you can attach to an issue.