27 lines
416 B
Bash
Executable file
27 lines
416 B
Bash
Executable file
#!/bin/sh
|
|
# Prompt for power options using dmenu
|
|
|
|
option=$(printf "Shutdown\nRestart\nLog out" | ~/.config/scripts/menu/menu "Power:")
|
|
|
|
_logout() {
|
|
if ps -a | grep -q 'tty1.*xinit' ; then
|
|
pkill xinit
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
_shutdown() {
|
|
shutdown now
|
|
}
|
|
|
|
_reboot() {
|
|
shutdown -r 0
|
|
}
|
|
|
|
case "$option" in
|
|
"Shutdown") _shutdown ;;
|
|
"Restart") _reboot ;;
|
|
"Log out") _logout ;;
|
|
*) exit 1 ;;
|
|
esac
|
|
|