Skip to content
rafa-rrayesPublic

About

A tiny macOS menu bar app to toggle lid sleep — keep your Mac awake with the lid closed in one click. ~100 lines of Swift, no dependencies, no preferences.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

LidLock

A macOS menu bar app that does one thing: toggle lid sleep.

Click the icon to keep your Mac awake with the lid closed. Click it again to go back to normal.

🌙 lid sleep on (normal)  ·  ☕️ lid sleep off (stays awake)

No dependencies, no background polling, no preferences. ~100 lines of Swift.

Install

curl -fsSL https://raw.githubusercontent.com/rafa-rrayes/LidLock/refs/heads/master/install.sh | bash

Requires macOS 11+ and Xcode Command Line Tools (xcode-select --install).

The installer asks for your password once to add a sudo rule, then builds the app into ~/Applications/LidLock.app and launches it.

To start it automatically: System Settings → General → Login Items → add LidLock.

Usage

  • Left click — toggle lid sleep
  • Right click — current state and Quit

How it works

The app shells out to two commands:

sudo pmset -a disablesleep 1   # lid sleep off
sudo pmset -a disablesleep 0   # lid sleep on

pmset needs root, so the installer writes /etc/sudoers.d/lidlock granting passwordless sudo for those two exact command lines only — no wildcards, no other arguments, nothing else escalated. On launch the app reads the live state from pmset -g, so the icon is never stale.

Uninstall

sudo pmset -a disablesleep 0
rm -rf ~/Applications/LidLock.app
sudo rm /etc/sudoers.d/lidlock

Build from source

git clone https://github.com/rafa-rrayes/lidlock.git
cd lidlock
./install.sh

build.sh alone recompiles without touching the sudo rule.

Caveats

  • Disabling lid sleep means a closed Mac in a bag can get hot. Toggle it back off when you're done.
  • The app is ad-hoc signed locally, not notarized — you built it yourself, so Gatekeeper stays out of the way.

License

MIT

About

A tiny macOS menu bar app to toggle lid sleep — keep your Mac awake with the lid closed in one click. ~100 lines of Swift, no dependencies, no preferences.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages