Anti-sleep for your Mac. A 100% Swift, menu-bar app that keeps your Mac awake — it prevents the display from sleeping, dimming, or starting the screensaver.
Black Coffee lives in your menu bar (no Dock icon). One click on the cup keeps your Mac awake; a built-in timer turns it back off when you're done. It's an original, personal-use app built on Apple's own system API (IOKit power assertions).
| Idle | Running (30-min timer) |
|---|---|
![]() |
![]() |
The panel opens when you click the cup in the menu bar.
- ☕ Menu-bar icon — filled = active, empty = idle; adapts to light/dark.
- Toggle keep-awake with a real power assertion (
PreventUserIdleDisplaySleep). - Duration timer: 15 / 30 / 45 / 60 min or ∞; turns off automatically when time is up.
- Live countdown while a timer is running.
- Notify when finished (optional).
- Open at login (via
SMAppService). - Localized — English, Português (BR) and Español, following your macOS language.
- No Dock icon — menu-bar only.
- Left-click the cup → open the panel (toggle, duration, options).
- Right-click the cup → toggle keep-awake instantly.
- On first launch the panel opens automatically so you can find the icon.
Tip (Macs with a notch): if the menu bar is crowded, the icon may hide behind the notch. Hold ⌘ and drag to rearrange menu-bar icons.
Black Coffee is not code-signed (it's a free, personal project). macOS quarantines apps downloaded from the internet, so the first launch needs one of these:
Option A — right-click open
- Move
Black Coffee.appto/Applications. - Right-click the app → Open → Open in the dialog. (Only needed once.)
Option B — clear the quarantine flag (Terminal)
xattr -dr com.apple.quarantine "/Applications/Black Coffee.app"Then open it normally.
Requires Xcode / Swift 6 on macOS 14+.
./build_app.shProduces Black Coffee.app (ad-hoc signed, with icon + localizations) in the project folder.
Regenerate the icon:
swift Tools/generate_icon.swift Branding
iconutil -c icns Branding/AppIcon.iconset -o Branding/AppIcon.icnsRegenerate the screenshots from the real UI:
BLACKCOFFEE_RENDER_DIR="$PWD/Branding" .build/release/BlackCoffeeVerify the anti-sleep core (should list the assertion):
BLACKCOFFEE_SELFTEST=1 .build/release/BlackCoffee & sleep 2; pmset -g assertions | grep -i "Black Coffee"; pkill -x BlackCoffee| File | Responsibility |
|---|---|
PowerAssertion.swift |
Anti-sleep core (IOKit) |
AppState.swift |
State, timer, launch-at-login, notifications |
ToggleStyles.swift |
Custom SwiftUI switch & checkbox |
PopoverView.swift |
Panel UI |
AppDelegate.swift |
Menu-bar item & popover positioning |
Localization.swift |
NSLocalizedString helper |
ScreenshotRenderer.swift |
Renders the UI to PNG (dev) |
main.swift |
Entry point (accessory app) |
Translations live in Localization/; branding assets in Branding/.

