Matthew Graham 2253d69340
a better way to turn the PC off
Possibly better and easier to read for people new to Linux/GNU using dmenu.
2018-12-13 13:19:51 -05:00

22 lines
359 B
Bash

#!/bin/sh
powerlevel=$(echo "Power off\nReboot" | dmenu -i -p "Power off or reboot?")
if [ "$powerlevel" = "" ]
then
exit
fi
if [ $(echo "No\nYes" | dmenu -i -p "Are you sure?") = "Yes" ]
then
if [ "$powerlevel" = "Power off" ]
then
exec sudo -A shutdown -hP now
fi
if [ "$powerlevel" = "Reboot" ]
then
exec sudo -A reboot
fi
fi