feat(just): add caffeinate recipe to prevent system sleep#351
Conversation
Wraps systemd-inhibit to provide a macOS caffeinate-like experience. Without args, holds sleep indefinitely until Ctrl+C. With args, holds sleep only while the given command runs. Closes #350 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 59 minutes and 36 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
hanthor
left a comment
There was a problem hiding this comment.
Clean implementation. LGTM.
Correctness: systemd-inhibit invocation is correct. Using exec avoids leaving a shell process behind. The --what flags are appropriate (sleep, idle, plus lid-switch for the indefinite case).
Edge cases: No-args mode uses sleep infinity which is the standard pattern. With-args mode correctly passes through to the user's command.
Style: Matches existing recipe conventions. Comments are helpful.
One minor suggestion (non-blocking): consider adding handle-lid-switch to the with-args mode as well for consistency, since a lid-close during a long build would also be disruptive. But the current split is reasonable — explicit command mode assumes the user is actively working.
|
Can't we just do the command without the ujust part? Ain't no one got time for that! |
🤖 Copilot Test ReportBranch: Test Results
ChangeAdds
Uses ContextThis is the ujust recipe approach vs #360/#361 which use shell aliases. These can co-exist. If the alias from #360 or #361 also merges, users get both |
Summary
Closes #350
Adds a
caffeinaterecipe todefault.justthat wrapssystemd-inhibitto provide the macOS caffeinate experience on Linux. Without args, holds sleep indefinitely until Ctrl+C. With args, holds sleep only while the given command runs.Usage
Changes
system_files/shared/usr/share/ublue-os/just/default.just: addcaffeinaterecipeTest plan
ujust caffeinateand confirmsystemd-inhibit --listshows the inhibitorujust caffeinate -- sleep 5and confirm inhibitor is released after 5 seconds