Skip to content

Instantly share code, notes, and snippets.

@AOx0
Created December 22, 2022 11:38
Show Gist options
  • Save AOx0/91e757d2ff363c181ba0a3bc7fff5d33 to your computer and use it in GitHub Desktop.
Save AOx0/91e757d2ff363c181ba0a3bc7fff5d33 to your computer and use it in GitHub Desktop.
function set-sleep --argument-names on
if [ "$on" = "on" ]
sudo pmset -b sleep 5; sudo pmset -b disablesleep 0;
echo "Enabled sleep";
else if [ "$on" = "off" ]
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1;
echo "Disabled sleep";
else
echo "Invalid first argument. Should be 'on' or 'off'"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment