Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1.97 KB

File metadata and controls

63 lines (44 loc) · 1.97 KB

Awake

Standalone system tray utility to prevent Windows from sleeping.

A lightweight, dependency-minimal reimplementation of PowerToys Awake in Rust. Uses Bootstrap Icons (cup-hot / cup-hot-fill) for the tray icon.

Features

  • Keep awake indefinitely — prevents system sleep
  • Keep screen on — optional display prevention checkbox
  • Start at login — toggles HKCU registry Run key
  • System tray — right-click context menu, state indicators, explorer restart resilience
  • Single instance — duplicate launches show a warning

Building

Prerequisites

  • Rust (stable)
  • Windows SDK (for windows-sys targets)

Cross-compilation (Linux → Windows)

rustup target add x86_64-pc-windows-gnu
sudo apt install mingw-w64
cargo build --target x86_64-pc-windows-gnu --release

Native (Windows)

cargo build --release

Usage

Launch Awake.exe. It sits in the system tray. 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

Architecture

src/
├── main.rs       Entry, single-instance mutex
├── state.rs      App state + SetThreadExecutionState
├── tray.rs       Window class, Shell_NotifyIcon, WndProc, context menu
├── icons.rs      ICO → HICON loading from embedded data
├── startup.rs    Registry Run key read/write
└── util.rs       Shared wide-string helper

Rendered icon data (Bootstrap Icons) is generated at build time via build.rs using resvg. No external icon files needed.

License

MIT