Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sidamo ☕

A brutally simple macOS menu bar app that keeps your MacBook awake with the lid shut — no external display required.

Named after the Ethiopian coffee region: it's the cup of coffee in your menu bar that keeps the machine up.

What it does

Cup filled Lid-shut sleep disabled — close the lid, the Mac stays on
Cup empty Normal sleep behavior

Click the cup → Keep Awake (Lid Shut) to toggle. That's the whole app.

Under the hood, ON means:

  1. sudo pmset -a disablesleep 1 — macOS ignores the lid entirely
  2. An in-process PreventSystemSleep power assertion (the same one caffeinate -s holds) as belt-and-braces on AC power

OFF (and quitting the app) reverses both. Quit always restores normal sleep, so the laptop can never end up cooking in a bag because the app died with the toggle on.

Install

./scripts/build-app.sh
open ~/Applications/Sidamo.app

Requires Xcode Command Line Tools (xcode-select --install) and macOS 13+.

How auth works (read this once)

Flipping disablesleep requires root. Instead of prompting for your password on every toggle, the first toggle shows the standard macOS administrator dialog once and installs a tightly-scoped rule at /etc/sudoers.d/sidamo:

you ALL=(root) NOPASSWD: /usr/bin/pmset -a disablesleep 1, /usr/bin/pmset -a disablesleep 0

Exactly those two commands become passwordless — nothing else gains any privilege. The rule is validated with visudo -c before being moved into place, and written via a temp name sudo ignores, so a half-written file can never be parsed.

Every toggle after that is instant and silent.

Uninstall

sudo pmset -a disablesleep 0        # restore normal sleep (the app does this on quit anyway)
sudo rm /etc/sudoers.d/sidamo       # remove the passwordless rule
rm -rf ~/Applications/Sidamo.app

CLI

The binary inside the bundle doubles as a command-line tool driving the exact same code path as the menu clicks:

~/Applications/Sidamo.app/Contents/MacOS/Sidamo --status   # "on" / "off"
~/Applications/Sidamo.app/Contents/MacOS/Sidamo --on
~/Applications/Sidamo.app/Contents/MacOS/Sidamo --off

Testing

All logic lives in SidamoCore behind injectable seams (CommandRunning, PrivilegeEscalating), so the full toggle/first-run/failure matrix is unit tested without touching your system or showing dialogs:

swift test

Covers: pmset -g parsing (real captured output plus edge cases), the exact sudo/pmset invocations, the sudoers rule content and its validated atomic install script (including compiling the generated AppleScript), first-run install-then-retry, cancelled-auth handling, and every CLI exit path.

The GUI shell (Sources/Sidamo/main.swift) is deliberately too thin to hide bugs: menu clicks call the same tested PowerController methods the CLI uses.

Logs

Sidamo writes to the unified log (subsystem com.kirk.sidamo): every toggle, every pmset call and its exit status, first-run install attempts, external state changes it notices, and the restore-on-quit. Watch it work:

log stream --predicate 'subsystem == "com.kirk.sidamo"' --level debug   # live
log show --predicate 'subsystem == "com.kirk.sidamo"' --last 1h         # history

(--level debug also shows the 5-second state polls; drop it to see just the interesting events. Console.app works too — filter on the subsystem.)

Safety notes

  • Lid shut + no display = no airflow through the hinge gap. Don't run heavy workloads closed-and-covered, and never bag the machine while the cup is filled. Quitting Sidamo restores normal sleep as a backstop.
  • The icon re-reads real state from pmset -g (on click and every 5 s), so it stays honest even if you flip the setting from a terminal.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages