Created
March 5, 2021 20:15
-
-
Save daystram/4619a0d19265bb8bc0e70ac7e06f558d to your computer and use it in GitHub Desktop.
MacBook toggle sleep on lid close script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| FLAG="$HOME/.lidsleep" | |
| if [[ -f $FLAG ]]; then | |
| sudo pmset -a disablesleep 0 | |
| rm $FLAG | |
| echo "lidsleep: enabled sleep on lid close" | |
| else | |
| sudo pmset -a disablesleep 1 | |
| touch $FLAG | |
| echo "lidsleep: disabled sleep on lid close" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment