Standalone system tray utility to prevent Windows from sleeping.
A lightweight .NET 9 Windows tray utility inspired by PowerToys Awake. Uses Bootstrap cup-hot / cup-hot-fill icons for active/off tray state.
- Keep awake indefinitely — prevents system sleep
- Keep screen on — optional display prevention checkbox
- Start at login — toggles HKCU registry Run key
- System tray — left-click or right-click context menu, state indicators, Explorer restart resilience
- Single instance — duplicate launches show a warning
- Single-file publish — framework-dependent
Awake.exewith app assemblies bundled
- .NET 9 SDK to build
- .NET 9 Desktop Runtime on machines that run the framework-dependent publish
- Windows 10/11 for runtime tray behavior
dotnet builddotnet run --project Awake.Tests/Awake.Tests.csprojdotnet publish Awake.csproj -c Release -r win-x64 --self-contained falseThe published executable is written to:
bin/Release/net9.0-windows/win-x64/publish/Awake.exe
Release publish is single-file and framework-dependent. The target machine still needs the .NET 9 Desktop Runtime installed.
Launch Awake.exe. It sits in the system tray. Left-click or right-click the icon for the menu.
| Action | Description |
|---|---|
| Keep awake indefinitely | Toggle system sleep prevention |
| Keep screen on | Also prevent display from turning off (disabled when awake is off) |
| Start at login | Auto-start with Windows via HKCU\...\Run\Awake |
| Exit | Cleanly stops sleep prevention and exits |
App/
├── Program.cs Entry, single-instance guard, startup diagnostics
├── TrayApplicationContext.cs WinForms NotifyIcon, menu, hidden tray host window
├── WindowsPowerStateApplier.cs SetThreadExecutionState adapter
├── WindowsStartupRegistry.cs HKCU Run key adapter
├── ProcessExecutablePathProvider.cs
├── MutexSingleInstanceLock.cs
└── AwakeIcons.cs Embedded active/off icon loading
Awake.Core/
├── TrayShellController.cs Tray state, menu projection, command handling
├── StartupManager.cs Startup registry boundary
├── SingleInstanceGuard.cs
├── StartupDiagnostics.cs
└── AwakeIconIdentity.cs
Awake.Tests/
└── Program.cs Lightweight behavior test runner
Icon source SVGs are checked in from Bootstrap Icons:
Assets/bootstrap-cup-hot.svgAssets/bootstrap-cup-hot-fill.svg
Generated ICOs are multi-size Windows icon files:
Assets/awake-off.icoAssets/awake-on.ico
To regenerate the ICOs from the SVG sources:
tmpdir=$(mktemp -d)
npm install --silent --prefix "$tmpdir" sharp
NODE_PATH="$tmpdir/node_modules" node tools/render-bootstrap-icons.mjs
rm -rf "$tmpdir"Before release, verify on Windows 10/11:
- Start
Awake.exe; it appears in the notification area and no main window/taskbar window appears. - Left-click and right-click both open the same tray menu.
- The menu spacing, typography, separators, checkmarks, disabled
Keep screen onstate, and active/off icons look clean at normal DPI. - Toggle Keep awake indefinitely; the tray icon and tooltip change to active.
- Toggle Keep screen on while Awake is active; then turn Awake off and confirm screen-on clears and disables.
- Toggle Start at login and confirm
HKCU\Software\Microsoft\Windows\CurrentVersion\Run\Awakeis created/removed. - Launch a second copy and confirm it shows the
Awake is already running.warning without disrupting the first process. - Restart Explorer and confirm the tray icon reappears and still opens the menu.
- Choose Exit and confirm the tray icon disappears and power-prevention state clears.
You can record the visual and lifecycle checks with:
powershell -ExecutionPolicy Bypass -File tools\windows-smoke-test.ps1The script writes records\topics\2026-06-13-dotnet9-tray-rewrite\manual-windows-smoke.txt.
MIT