Skip to content

Repository files navigation

Black Coffee app icon

Black Coffee

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).

Screenshots

Idle Running (30-min timer)
Idle panel Active panel with countdown

The panel opens when you click the cup in the menu bar.

Features

  • 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.

Usage

  • 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.

Install

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

  1. Move Black Coffee.app to /Applications.
  2. Right-click the app → OpenOpen 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.

Build from source

Requires Xcode / Swift 6 on macOS 14+.

./build_app.sh

Produces 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.icns

Regenerate the screenshots from the real UI:

BLACKCOFFEE_RENDER_DIR="$PWD/Branding" .build/release/BlackCoffee

Verify 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

Project layout

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/.


Personal use • macOS 14+ • Apple Silicon • not code-signed

About

☕ Keep your Mac awake — a lightweight, native menu-bar anti-sleep app. Timer, notifications, launch-at-login, and English/Português/Español. 100% Swift.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages