feat(desktop): keep the Mac awake while agents work, lid closed included

Codeman > Keep This Mac Awake in the macOS app: While Agents Work (an
agent at work, plus 5 minutes after the last one stops) or Always While
Codeman Is Open. Off by default, and only for a Codeman on this Mac.

- Idle sleep needs no password: the app holds an NSProcessInfo activity
  with IdleSystemSleepDisabled, which the kernel drops with the process.
  While it only watches for work, an activity that still allows sleep
  keeps App Nap from slowing its look at the server.
- On a MacBook, Only on Power Adapter (on by default) pauses it on
  battery, and Also With the Lid Closed installs a small LaunchDaemon
  behind macOS's administrator prompt. It sets pmset disablesleep only
  while the app keeps a fresh request file with its live pid, only on
  the power adapter, and undoes only what it set itself. The app writes
  the script and plist as root from the copies built into it.
- A status line at the bottom of the submenu says what it does now.

This brings the macOS part of the keep-awake idea from PR #595 into the
app; the server-side setting and the Linux route are left out for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-09 04:51:39 +01:00
1 parent f62c1f7e2f
commit 79a6c03363
10 files changed
+2474

No files matched your search

+9
View File
@@ -252,6 +252,15 @@ On a MacBook Pro with a PROLED XDR display, whose lid logo lights up,
your own for working, for waiting for you and for needing permission. All three are off
until you choose, and the menu only exists on such a Mac.
**Codeman > Keep This Mac Awake** stops the Mac from going to sleep while your agents work
on it (**While Agents Work**, plus 5 minutes after the last one stops), or for as long as
the app is open (**Always While Codeman Is Open**). It is off until you choose, only acts
for a Codeman running on this Mac, needs no password, and ends when the app quits. On a
MacBook it pauses on battery unless you untick **Only on Power Adapter**, and **Also With
the Lid Closed…** keeps a closed MacBook awake too: that one asks for your administrator
password once to install a small helper, never acts on battery, and **Remove the Lid
Helper…** takes it out again.
### First launch
1. Open `Codeman.dmg` and drag Codeman into Applications.