A lightweight macOS menu bar app that prevents your display from sleeping.
- Menu bar icon toggle — click the eye icon to enable/disable
- Uses
IOPMAssertionCreateWithNameto prevent idle display sleep - No Dock icon, lives entirely in the menu bar
- Keyboard shortcuts:
⌘Kto toggle,⌘Qto quit
- macOS 14.0+
- Xcode 15+
Open KeepAwake.xcodeproj in Xcode and run, or:
xcodebuild -project KeepAwake.xcodeproj -scheme KeepAwake buildPowerManager creates an IOKit power assertion of type kIOPMAssertionTypePreventUserIdleDisplaySleep to keep the display awake. The assertion is automatically released when disabled or when the app terminates.
KeepAwake/
├── KeepAwakeApp.swift # App entry point, menu bar UI
├── PowerManager.swift # IOKit power assertion management
├── Info.plist # LSUIElement=true (hide Dock icon)
└── Assets.xcassets/ # App icons
MIT