{"id":50873514,"url":"https://github.com/pehqge/coffee","last_synced_at":"2026-06-15T07:05:56.702Z","repository":{"id":363890505,"uuid":"1265418251","full_name":"pehqge/coffee","owner":"pehqge","description":"Keep your Mac awake with the lid closed — a tiny macOS menu bar app. One click, ~16 MB RAM.","archived":false,"fork":false,"pushed_at":"2026-06-10T19:04:00.000Z","size":1754,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-10T21:05:02.141Z","etag":null,"topics":["appkit","caffeine","clamshell","keep-awake","macos","menubar","pmset","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pehqge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-10T18:55:58.000Z","updated_at":"2026-06-10T19:04:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pehqge/coffee","commit_stats":null,"previous_names":["pehqge/coffee"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pehqge/coffee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pehqge%2Fcoffee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pehqge%2Fcoffee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pehqge%2Fcoffee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pehqge%2Fcoffee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pehqge","download_url":"https://codeload.github.com/pehqge/coffee/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pehqge%2Fcoffee/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34351474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appkit","caffeine","clamshell","keep-awake","macos","menubar","pmset","swift"],"created_at":"2026-06-15T07:05:54.257Z","updated_at":"2026-06-15T07:05:56.680Z","avatar_url":"https://github.com/pehqge.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCoffee\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eKeep your Mac awake with the lid closed — one click in the menu bar.\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/macOS-13%2B-111?logo=apple\u0026logoColor=white\" alt=\"macOS 13+\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Apple%20Silicon-arm64-111?logo=apple\u0026logoColor=white\" alt=\"Apple Silicon\"\u003e\n  \u003ca href=\"https://github.com/pehqge/coffee/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/pehqge/coffee?color=8a4b2a\u0026label=download\" alt=\"Latest release\"\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-8a4b2a\" alt=\"License: Apache 2.0\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/RAM-~16%20MB-3aa757\" alt=\"~16 MB RAM\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/hero.png\" alt=\"Coffee — a macOS menu bar app that keeps your Mac awake with the lid closed\" width=\"760\"\u003e\n\u003c/p\u003e\n\n---\n\n**Coffee** is a tiny native macOS menu-bar app that toggles a single system\nsetting: whether your Mac keeps running when you close the lid. Useful when you\nwant background jobs, downloads, agents, or a server to keep going while the\nlaptop is shut and tucked away.\n\nOne click on the cup flips it. The icon always reflects the **real** system\nstate — even if you change it from the terminal — because it reads live from\n`pmset`. It launches at login, weighs about **16 MB** of memory, and does\nnothing else.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/states.png\" alt=\"Menu bar icon: bright with steam when ON, translucent when OFF\" width=\"720\"\u003e\n\u003c/p\u003e\n\n## Why\n\n- **One click** — left-click the cup to enable/disable. Right-click for a small menu.\n- **Always truthful** — reads live state from `pmset` every few seconds, so external changes show up too.\n- **Featherweight** — native Swift / AppKit, ~16 MB resident, no background CPU.\n- **Starts at login** — installs its own `LaunchAgent` the first time it runs.\n- **Scoped \u0026 safe** — the only privileged thing it does is `pmset -a disablesleep 0|1`, via a narrowly-scoped passwordless `sudo` rule it helps you install once.\n\n---\n\n## Install\n\n1. **Download** [`Coffee.zip`](https://github.com/pehqge/coffee/releases/latest/download/Coffee.zip) from the [latest release](https://github.com/pehqge/coffee/releases/latest).\n2. Unzip and drag **Coffee.app** into your **Applications** folder.\n3. The app is open-source and signed ad-hoc (not notarized), so macOS quarantines it on download. Clear that once:\n   ```bash\n   xattr -dr com.apple.quarantine /Applications/Coffee.app\n   ```\n   \u003e Prefer clicking? Double-click the app, then go to **System Settings → Privacy \u0026 Security → Open Anyway**.\n4. Open **Coffee.app**. A cup appears in your menu bar (top-right).\n\n### One-time permission\n\nChanging the lid setting needs `root`. On first launch Coffee detects it has no\npermission, **copies the exact setup command to your clipboard**, and shows you\na dialog. Just:\n\n1. Click **Open Terminal** in the dialog.\n2. Paste (**⌘V**), press **Return**, and type your Mac password **once**.\n\nThat writes a `sudoers` rule allowing *only* `pmset -a disablesleep 0|1` without\na password — nothing else. After that, toggling is instant. You can re-trigger\nthis anytime from the right-click menu → **Setup permission…**\n\n---\n\n## Usage\n\n- **Left-click** the cup → toggle on/off.\n  - **ON** → bright cup with steam. Mac stays awake with the lid closed (battery *and* power).\n  - **OFF** → translucent cup. Normal sleep behavior.\n- **Right-click** → status, Enable/Disable, Setup, Quit.\n\n\u003e Heads-up: running with the lid closed means no airflow, so the Mac runs hotter,\n\u003e and the battery drains faster since the display and CPU stay active.\n\n---\n\n## Build from source\n\nRequires the Xcode Command Line Tools (`xcode-select --install`).\n\n```bash\ngit clone https://github.com/pehqge/coffee\ncd coffee\n./build.sh          # compiles, bundles the icon, signs → ./Coffee.app\n```\n\nThe whole app is a single Swift file: [`src/main.swift`](src/main.swift).\n\n---\n\n## How it works\n\n- The setting is `pmset -a disablesleep` (`1` = stay awake with lid closed, `0` = normal). `SleepDisabled` in `pmset -g` is the source of truth.\n- Coffee reads that value on a light 10-second timer (with tolerance, so it's effectively free) and on every click.\n- Toggling runs `sudo -n /usr/bin/pmset -a disablesleep 0|1`, permitted without a password by `/etc/sudoers.d/coffee-lid`, scoped to exactly those two commands.\n- Autostart is a user `LaunchAgent` at `~/Library/LaunchAgents/com.pedro.coffeelid.plist`, which the app writes itself if missing.\n\n## Uninstall\n\n```bash\nlaunchctl bootout gui/$(id -u)/com.pedro.coffeelid\nrm -rf /Applications/Coffee.app ~/Library/LaunchAgents/com.pedro.coffeelid.plist\nsudo rm -f /etc/sudoers.d/coffee-lid\n```\n\n---\n\n## License\n\n[Apache 2.0](LICENSE) © Pedro Gimenez\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpehqge%2Fcoffee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpehqge%2Fcoffee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpehqge%2Fcoffee/lists"}