Skip to content

feat: keep the computer awake on Linux and macOS - #103

Merged
httpsphl merged 1 commit into
mainfrom
feat/unix-keep-awake
Oct 2, 2026
Merged

httpsphl merged 1 commit into
mainfrom
feat/unix-keep-awake

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Closes one of the Linux/macOS gaps (spec 14.1): Keep the computer awake while bots work now works off Windows.

  • platform/unix/power.rs: while any bot is busy (and the setting is on), a helper process holds the request.
    • macOS: caffeinate -i -w <daemon pid>.
    • Linux: systemd-inhibit --what=idle --mode=block around a sh that waits for the daemon to go away.
  • Like the Windows power request, it only stops sleep after inactivity; the lid and Sleep still work. The helper ends with the daemon, so a crash does not keep the computer awake.
  • A helper that exits within 200 ms, as systemd-inhibit does with no logind, returns an error, which the caller logs.
  • The old keep-awake test is Windows-only now. The new Unix test skips where no helper can run: it skipped in the Docker container, which has no logind. The macOS CI job runs it for real with caffeinate.
  • The README and the code signing policy describe 0.8.0, where this is Windows-only, so they change with the next release.

Manual test (not done yet)

  • macOS:
    1. With a bot working, pmset -g assertions lists caffeinate.
    2. Once the bot is idle, it is gone.
  • Linux: the same check with systemd-inhibit --list showing Botloft.

…macOS

A helper process holds the request while any bot is busy: caffeinate -i
on macOS, an idle lock of systemd-inhibit on Linux. Like the power
request on Windows it only stops sleep after inactivity, and it ends
with the daemon. A helper that stops at once (no logind) is an error in
the log.
@httpsphl
httpsphl merged commit a4033a4 into main Oct 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant