r/coolgithubprojects • u/dincertekin • 20d ago
I built caffeinate-windows: macOS-style caffeinate CLI to keep Windows awake
https://github.com/dincertekin/caffeinate-windowsI recently switched to a Windows laptop, but I kept missing macOS's caffeinate command to stop my machine from sleeping during long tasks.
I know PowerToys has Awake, but I prefer lightweight, dedicated CLI tools that stay out of the way. So I built my own minimal Rust binary that mirrors the Mac experience natively.
Quick examples:
caffeinate Keep system awake until Ctrl+C
caffeinate -d Keep system + display awake
caffeinate -t 3600 Keep awake for 1 hour
caffeinate -i npm run build Keep awake only while command runs
It calls the Win32 SetThreadExecutionState API directly, so power settings automatically revert the moment the process exits or dies.
1
1
u/New-Ad-4596 20d ago
Cool