Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By LeonMelamudv1.2.0MITIn 1 marketplace
Keeps a Mac awake, lid closed, while any Claude Code session works, then restores sleep when the last finishes. Hooks fire on every prompt and tool call and need a one-time sudoers entry for pmset.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
2 cautions to review before installing
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
sleep-prevention, lid-closed, pmset, power-management, battery, hooks, sleep
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.

Keep a MacBook awake (lid closed or not) while any Claude Code session is working, and re-enable sleep the moment the last session finishes. Multi-session safe, O(1) per event, no daemons, no polling.
Claude Code hooks call the script on session activity:
| Hook | Call | Effect |
|---|---|---|
UserPromptSubmit | lid-awake.sh on | touch .lid-awake-flags/<session_id>, pmset -a disablesleep 1 |
PostToolUse | lid-awake.sh on | re-arm the hold once work resumes (no-op while already holding) |
Notification | lid-awake.sh off | Claude is blocked on you (permission prompt / idle input) — stop holding |
Stop / SessionEnd | lid-awake.sh off | remove the flag; if the flags dir is empty → disablesleep 0 |
Waiting on a human is not work. Stop covers the end of a turn, and Notification covers the mid-turn case — a permission prompt can block for hours, and there's no reason to burn battery through it. PostToolUse puts the hold back the moment the tool actually runs, so approving a prompt and walking away still keeps the Mac awake for the rest of the turn.
The flag directory is the real-time state: one empty file per live session. touch/rm are O(1); sleep is only re-enabled when the last holder leaves. A single 0/1 flag file was considered and rejected — it can't refcount, so the first session to stop would re-enable sleep under a second still-working session (that was the original bug).
Safety nets:
lid-awake.sh reap every 5 min — no claude process anywhere means no flag can legitimately be holding. Install once with bash lid-awake.sh install-reaper; status tells you if it's missing.~/.claude/scripts/lid-awake.log, self-truncated at ~200KB.status / clear subcommands for debugging and manual unstick.The repo is a self-hosting plugin: hooks are registered automatically, no settings.json editing.
In Claude Code:
/plugin marketplace add LeonMelamud/lid-awake
/plugin install lid-awake@lid-awake
Allow the two exact pmset commands without a password (one-time, the only manual step — no plugin can or should automate sudoers):
echo "$USER ALL=(root) NOPASSWD: /usr/bin/pmset -a disablesleep 1, /usr/bin/pmset -a disablesleep 0" \
| sudo tee /etc/sudoers.d/lid-awake >/dev/null && sudo chmod 440 /etc/sudoers.d/lid-awake \
&& sudo visudo -c
The final visudo -c must print "parsed OK" — a malformed sudoers file can break sudo itself, so if it complains, remove the file (sudo rm /etc/sudoers.d/lid-awake) and retry.
Done. Verify with bash lid-awake.sh status after your next prompt.
Copy the script:
mkdir -p ~/.claude/scripts
cp lid-awake.sh ~/.claude/scripts/lid-awake.sh
Add the sudoers entry from step 2 above.
Wire the hooks in ~/.claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{ "hooks": [{ "type": "command", "command": "bash ~/.claude/scripts/lid-awake.sh on", "async": true }] }
],
"PostToolUse": [
{ "hooks": [{ "type": "command", "command": "bash ~/.claude/scripts/lid-awake.sh on", "async": true }] }
],
"Notification": [
{ "hooks": [{ "type": "command", "command": "bash ~/.claude/scripts/lid-awake.sh off", "async": true }] }
],
"Stop": [
{ "hooks": [{ "type": "command", "command": "bash ~/.claude/scripts/lid-awake.sh off", "async": true }] }
],
"SessionEnd": [
{ "hooks": [{ "type": "command", "command": "bash ~/.claude/scripts/lid-awake.sh off", "async": true }] }
]
}
}
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub leonmelamud/lid-awake --plugin lid-awakePlugins from other owners that cover similar ground