A SwiftBar plugin to control macOS caffeinate
directly from the menu bar.
Keep your Mac awake for SSH, Docker, or long-running tasks while letting the display sleep. Supports indefinite mode, timed sessions, safe process tracking, and battery warnings.
- ✅ Toggle keep-awake (indefinite mode)
- ✅ Timed sessions: 1h / 4h / 8h
- ✅ Countdown timer in the menu bar
- ✅ Safe PID tracking → only manages its own
caffeinate
- ✅ External detection → shows if another caffeinate process is running
- ✅ Turn display off now without stopping system awake
- ✅ Stop + Turn display off in one click
- ✅ Battery warnings if awake mode is running on battery
- Install SwiftBar.
- Choose or create a Plugins folder (Preferences → General).
- Copy the plugin into your folder as
swiftbar-caffeinate-toggle.1m.sh
- Make it executable:
chmod +x ~/SwiftBarPlugins/swiftbar-caffeinate-toggle.1m.sh
- SwiftBar will auto-detect it and show ⚡ / 🌙 in your menu bar.
- Menu bar title
- ⚡ Keep Awake — caffeinate running
- ⚡ Keep Awake (external) — caffeinate detected outside plugin
- 🌙 Auto-sleep — no caffeinate running
- Dropdown options
- Toggle → start/stop indefinite keep-awake
- Stop Keep Awake → stop only
- Stop & Turn Display Off Now → stop caffeinate and immediately blank screen
- Restart Indefinite → stop + restart a fresh session
- Timed sessions → 1h / 4h / 8h (with live countdown in menu bar)
- Turn Display Off Now → blank screen while leaving system state unchanged
- Battery Warning
- If keep-awake is active on battery, the menu shows:
⚠️ Running on battery — consider plugging in.
- If keep-awake is active on battery, the menu shows:
MIT License — free to use, modify, and share.