Skip to content

moghtaderi/cortado

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cortado app icon

Cortado

A tiny macOS menu bar app that keeps your Mac awake.

Pick a duration, hit go. Cortado prevents idle sleep so your uploads, downloads, and long-running AI jobs keep working while you step away from the keyboard.

macOS 14+ Swift 6 License: MIT Tests


Features

  • Preset durations — 10 min, 30 min, 1 / 2 / 4 / 8 / 12 / 24 hours, or indefinite.
  • Live countdown in the menu bar☕ 45m, ☕ 2h 15m, or ☕ ∞.
  • Keep the display awake too (optional toggle, live — flip it any time during a session).
  • Launch at login — on by default; uncheck in the menu to turn off.
  • Keyboard shortcuts — ⌘0–⌘8 for durations, ⌘. to stop, ⌘Q to quit.
  • Zero permissions — no notifications, no network, no accessibility, no data collection, no sandbox.
  • Tiny and native — one Swift Package, no third-party dependencies, universal binary (Apple Silicon + Intel).

Why another one?

macOS already ships caffeinate(1). It's great, except you have to open Terminal, remember the flags, and remember to kill it. Cortado wraps the same underlying API (IOPMAssertionCreateWithName) in a menu bar that's faster to reach than your shell alias — and it shows you how much time is left.

Inspired by Lungo and the original Caffeine. Intentionally smaller than either — no preferences window, no custom durations, no automations. One menu, one job.

Install

Build from source (one command)

git clone https://github.com/moghtaderi/cortado.git
cd cortado
./build.sh

This produces build/Cortado.app. Drag it to /Applications and open it once from Finder (right-click → Open the first time, because it's ad-hoc signed).

Prebuilt release

Grab the latest .app from the Releases page. Same right-click-Open-first-time caveat.

Usage

Click the ☕ in your menu bar. Pick a duration. That's the whole manual.

Action Shortcut
Until I turn it off ⌘0
10 minutes ⌘1
30 minutes ⌘2
1 hour ⌘3
2 hours ⌘4
4 hours ⌘5
8 hours ⌘6
12 hours ⌘7
24 hours ⌘8
Stop Cortado ⌘.
Quit Cortado ⌘Q

To verify Cortado is actually keeping your Mac awake, run:

pmset -g assertions | grep Cortado

You'll see PreventUserIdleSystemSleep (always) and, if you've enabled "Keep display awake too", also PreventUserIdleDisplaySleep.

How it works

Cortado uses Apple's IOPMAssertionCreateWithName — the same API that caffeinate(1) calls internally. Two assertion types are used:

Assertion When Prevents
PreventUserIdleSystemSleep always while active CPU, network, and background tasks from sleeping
PreventUserIdleDisplaySleep only with "Keep display awake too" the screen from dimming

If Cortado crashes or is force-quit, macOS automatically releases its assertions — no stuck state.

Development

swift build            # debug build
swift test             # 26 unit tests
swift run Cortado      # run unbundled (useful while iterating)
./build.sh             # build the real Cortado.app

Project layout

Sources/Cortado/
  CortadoApp.swift      # @main, MenuBarExtra scene
  Duration.swift        # preset enum + label formatting
  Preferences.swift     # @Observable UserDefaults wrapper
  WakeController.swift  # IOKit IOPMAssertion wrapper (+ fake for tests)
  TimerModel.swift      # countdown state machine
  LoginItem.swift       # SMAppService wrapper
  MenuBarLabel.swift    # menu-bar icon + countdown view
  MenuContent.swift     # the dropdown menu
Resources/Info.plist    # LSUIElement, bundle metadata
tools/MakeIcon.swift    # generates AppIcon.icns from Core Graphics

Tech

  • Swift 6 with strict concurrency
  • SwiftUI MenuBarExtra + @Observable
  • IOKit IOPMAssertion for sleep prevention
  • SMAppService.mainApp for launch-at-login
  • Swift Testing for unit tests
  • Core Graphics for the app icon — no external asset files

No third-party dependencies. No Xcode project file — open Package.swift in Xcode or just swift test from the command line.

Contributing

PRs welcome. If the change is small, send it. If it's big, open an issue first so we can talk through it. Please run swift test before opening a PR.

Good first-issue candidates:

  • Signed / notarized release builds
  • Localization
  • A cortado(1) CLI companion
  • Menu bar countdown formatting options

Credits

  • Inspired by Lungo by Sindre Sorhus.
  • Icon concept supplied by @moghtaderi, redrawn in Core Graphics so it stays crisp at every size from 16×16 to 1024×1024.

License

MIT — do whatever you want with it.

About

A tiny macOS menu bar app that keeps your Mac awake. Native Swift, zero dependencies, zero permissions.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors