A native macOS menu bar app that keeps your Mac awake after it detects extended mouse/keyboard inactivity.
Unzip StayAwake.app.zip and drag StayAwake.app to your Applications
folder. The app isn't notarized yet, so on first launch, right-click (or
Control-click) the app and choose Open — macOS will otherwise block it
as being from an unidentified developer.
- After 2 minutes (configurable) with no mouse or keyboard activity,
StayAwake holds a system power assertion (
IOPMAssertionCreateWithName) that prevents the Mac from sleeping. - The assertion is refreshed every 1 minute (configurable) while idle continues, and released the moment you touch the mouse or keyboard again.
- No Dock icon, no Cmd-Tab entry — StayAwake lives entirely in the menu bar.
Click the icon for status ("Monitoring" / "Keeping awake — last refreshed …" / "Disabled" / "Error — could not prevent sleep"), an Enable/Disable toggle, Preferences, and Quit. While actively keeping the Mac awake on battery power (not plugged in), the icon shows a small plug badge and the status line adds "— please connect power", since holding the machine awake drains the battery faster than letting it sleep normally.
- Idle threshold (1–30 minutes)
- Keep-awake refresh interval (15–300 seconds)
- Launch at Login
Requires macOS 13+ and Swift 5.9+.
Build and test:
swift build
swift testRun during development (menu bar icon appears, no Dock icon):
swift runBuild a distributable .app bundle:
./build.sh
open .build/StayAwake.appPushing a v* tag triggers .github/workflows/release.yml,
which runs on a macOS GitHub Actions runner: swift test, then ./build.sh
to produce StayAwake.app, zips it, and publishes it as a GitHub Release
attached to that tag.
git tag v1.0.0
git push origin v1.0.0