a better way to turn the PC off

Possibly better and easier to read for people new to Linux/GNU using dmenu.
This commit is contained in:
Matthew Graham 2018-12-13 13:19:51 -05:00 committed by GitHub
parent d81df93aa0
commit 2253d69340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

21
.scripts/i3cmds/turnoff Normal file
View File

@ -0,0 +1,21 @@
#!/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