blackout-win
v0.2.0
Published
Turn off your display on Windows instantly, from a global hotkey, a tray icon or the command line.
Maintainers
Readme
Blackout
Turn off your display on Windows instantly: from a global hotkey, a tray icon, or the command line. Move the mouse or press a key to wake it.
Unlike sleep or a screen saver, everything keeps running (downloads, music, builds); only the monitors power down. No admin rights, and no unsigned exe: Blackout runs on the Node.js and Windows PowerShell already on your PC, so Smart App Control doesn't block it.
Install
npm install -g blackout-winbun add -g blackout-winOr try it once without installing: npx blackout-win / bunx blackout-win.
Use
blackout tray # tray icon + shortcut (default Ctrl+Alt+M)
blackout startup on # start the tray app when you sign in
blackout settings # pick your shortcuts in a windowPress Ctrl+Alt+M to turn the screen off, and press it again to turn it back on. While the screen is off, the mouse and keyboard are ignored, so a bumped mouse or a cat on the keyboard won't wake it (and stray keys don't reach your apps). Ctrl+Alt+Del always works as an escape.
Tray: left-click the icon to turn the screen off. Right-click for Lock and turn off, Settings, Start with Windows and Quit.
Settings window: click a box, press the keys you want, Save. Choose a different shortcut for turning the screen back on, and whether only the shortcut or any key/mouse movement wakes it.
Command line
blackout # turn the screen off now
blackout --lock # lock the PC, then turn the screen off
blackout --delay 5s # wait first
blackout hotkey ctrl+alt+b # change the turn-off shortcut
blackout wake-key ctrl+alt+n # separate turn-on shortcut (blackout wake-key same to undo)
blackout wake-mode any # any key or mouse wakes it (blackout wake-mode shortcut to undo)
blackout status # show current shortcuts and settings
blackout stop # quit the tray app
blackout startup offChanges apply to a running tray right away. Settings live in %APPDATA%\Blackout\settings.json.
Shortcuts: any of ctrl, alt, shift, win plus a letter, digit, f1–f24, or pause, scrolllock, insert, home, end, pageup, pagedown, space, arrow keys. Letters, digits and similar keys need Ctrl, Alt or Win so they don't take over normal typing. If a shortcut is already taken by another app (or by a desktop shortcut's Shortcut key), Blackout tells you and the tray icon still works.
startup on points at the installed package, so use it with a global install, not npx/bunx.
How it works
bin/blackout.js passes your command to lib/blackout.ps1, which runs in the built-in Windows PowerShell 5.1. It broadcasts WM_SYSCOMMAND / SC_MONITORPOWER (the same thing Windows does when its display-off timer fires), registers the shortcut with RegisterHotKey, and shows the tray icon with WinForms. While the screen is off, low-level keyboard and mouse hooks watch for the turn-on shortcut and (in the default mode) swallow everything else; Windows' display-state notification ends that mode if anything else, like Ctrl+Alt+Del, turns the screen on. Start with Windows is a shortcut in your Startup folder.
Develop
npm test
node bin/blackout.js helpPushing a vX.Y.Z tag that matches package.json creates a GitHub release and publishes to npm when the NPM_TOKEN secret is set.
License
MIT
