Turn off your Mac's display the moment you lock the screen.
When you press Ctrl-⌘-Q (Lock Screen), macOS locks the session but keeps the display on until the display-sleep timer expires — and the shortest interval System Settings offers is 1 minute. DisplaySleepOnLock closes that gap: a tiny background daemon listens for the system lock notification and puts the display to sleep about one second after you lock.
- Immediate — the display turns off ~1 s after locking instead of waiting out the display-sleep timer
- Zero dependencies — one single-file Swift daemon built with the system toolchain; no Hammerspoon, no third-party apps
- Self-managing — installed as a launchd agent that starts at login and is restarted automatically if it ever exits
- Featherweight — ~60 KB binary, idles at 0% CPU
- macOS (developed and tested on macOS 27)
- A Swift toolchain to build the binary: Xcode, or the Command Line Tools (
xcode-select --install)
git clone https://github.com/cunminF/DisplaySleepOnLock.git
cd DisplaySleepOnLock
./install.shinstall.sh compiles the daemon to ~/bin/DisplaySleepOnLock, writes the LaunchAgent ~/Library/LaunchAgents/local.DisplaySleepOnLock.plist, and loads it. Done — press Ctrl-⌘-Q and the display goes dark right after the lock screen appears. Move the mouse or press a key to wake and unlock as usual.
macOS broadcasts a distributed notification named com.apple.screenIsLocked whenever the screen locks. The daemon subscribes to it via DistributedNotificationCenter and, one second later (letting the lock-screen transition settle), runs pmset displaysleepnow.
Activity is logged to ~/Library/Logs/DisplaySleepOnLock.log. Each lock should produce a screenIsLocked received line followed by pmset displaysleepnow issued. If it doesn't, please open an issue with the log contents and your macOS version.
./uninstall.shMIT © 2026 cunminF