Ultra-light Windows tray app that prevents idle sleep. Left-click toggles. Right-click shows menu, Settings, and About. Dark/light follows system theme.
- Prevents idle system sleep
- Optional display stay-on
- Single-instance guard
- Auto-start toggle (HKCU\Run)
- Theme-aware Settings + About
- Pure .NET 8 WinForms
- Windows 11
- Windows 10 (1607+)
Requires x64
- Releases: single portable
CaffeineTray.exe
No installer. No extra files.
Double-click CaffeineTray.exe.
Tray icon appears.
Left-click: toggle on/off.
Right-click: menu -> Settings..., About..., Exit.
Only needed if you want to build; running the release EXE does not need .NET.
winget install Microsoft.DotNet.SDK.8 # Install .NET 8
winget install Microsoft.VisualStudioCode # Install Visual Studio Code
code --install-extension ms-dotnettools.csharp # Install C# vscode extensiongit clone https://github.com/TheNolle/CaffeineTray.git
cd CaffeineTray
dotnet builddotnet publish -c Release -r win-x64 `
-p:SelfContained=true -p:PublishSingleFile=true `
-p:TrimMode=link -p:InvariantGlobalization=true
# output:
# .\bin\Release\net8.0-windows\win-x64\publish\CaffeineTray.exe- ON blocks idle sleep.
- Also keep display awake blocks screen-off due to idle.
- Battery saver does not disable this. Manual sleep, lid-close, group policy, or critical battery can still suspend the PC.
powercfg /requestsSYSTEM:
[PROCESS] CaffeineTray.exe
DISPLAY: # only if display option enabled
[PROCESS] CaffeineTray.exe- Start enabled: app starts ON
- Also keep display awake: blocks screen-off
- Run at Windows startup: toggles HKCU...\Run
Copy a shortcut to:
%APPDATA%\Microsoft\Windows\Start Menu\Programs\StartupFollows Windows Apps theme:
- Light: standard WinForms palette
- Dark: dark content colors + DWM dark titlebar
Auto-updates on theme change.
A global mutex prevents multiple instances. Second launch exits immediately.
- Uses
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED*) - Re-applies after resume and unlock
- Does not override:
- Manual Sleep/Shutdown/Restart
- Lid close policy
- Critical battery actions
- Admin/Group Policy timers
- OEM power tools
- No tray icon: Explorer may have restarted. Unlock or re-login, or right-click -> Exit then relaunch. Icons are embedded; the EXE alone is sufficient.
- Double-click does nothing: an instance is already running in tray (single-instance guard).
powercfg /requestsshows nothing: ensure app is ON. Left-click the icon to toggle.
Project targets net8.0-windows. Pure WinForms. Icons embedded as resources. No external deps.
- Single-file self-contained publish:
dotnet publish -c Release -r win-x64 -p:SelfContained=true -p:PublishSingleFile=true -p:TrimMode=link -p:InvariantGlobalization=true- Framework-dependent publish (tiny, needs .NET Desktop Runtime):
dotnet publish -c Release -r win-x64 -p:SelfContained=false -p:PublishSingleFile=false- Open issues: https://github.com/TheNolle/CaffeineTray/issues
- Send small, focused PRs. Keep it ultra-light. No new deps without discussion.
- Code style: minimal, documented where non-obvious, no bloat.
- No telemetry
- No network calls
- collected
- Author: Nolly @ Nolly's Holding
- Versioning: 1.0.0 (Major.Minor.Hotfix)