Skip to content

Instantly share code, notes, and snippets.

@TheBunnyMan123
Created July 30, 2024 18:55
Show Gist options
  • Save TheBunnyMan123/1117813c46720fc66b1ff8b602a5e09a to your computer and use it in GitHub Desktop.
Save TheBunnyMan123/1117813c46720fc66b1ff8b602a5e09a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
exec 3>&1;
result=$(dialog --radiolist "Power Options" 0 0 2>&1 1>&3 5 "Shut Down" 1 "on" "Restart" 2 "off" "Suspend" 3 "off" "Hibernate" 4 "off" "Hybrid Sleep" 5 "off")
exec 3>&-;
if [[ "$result" = "Shut Down" ]]
then
systemctl poweroff
elif [[ "$result" = "Restart" ]]
then
systemctl restart
elif [[ "$result" = "Suspend" ]]
then
systemctl suspend
elif [[ "$result" = "Hibernate" ]]
then
systemctl hibernate
elif [[ "$result" = "Hybrid Sleep" ]]
then
systemctl hybrid-sleep
else
clear
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment