Skip to content

Instantly share code, notes, and snippets.

@daystram
Created March 5, 2021 20:15
Show Gist options
  • Select an option

  • Save daystram/4619a0d19265bb8bc0e70ac7e06f558d to your computer and use it in GitHub Desktop.

Select an option

Save daystram/4619a0d19265bb8bc0e70ac7e06f558d to your computer and use it in GitHub Desktop.

Revisions

  1. daystram created this gist Mar 5, 2021.
    14 changes: 14 additions & 0 deletions lidsleep.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/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