|
|
@ -1,14 +1,16 @@
|
|
|
|
POWER_OFF=" Power Off"
|
|
|
|
POWER_OFF=" Power Off"
|
|
|
|
REBOOT=" Reboot"
|
|
|
|
REBOOT=" Reboot"
|
|
|
|
SUSPEND=" Suspend"
|
|
|
|
SUSPEND=" Suspend"
|
|
|
|
|
|
|
|
LOCK=" Lock"
|
|
|
|
LOG_OUT=" Log out"
|
|
|
|
LOG_OUT=" Log out"
|
|
|
|
|
|
|
|
|
|
|
|
chosen=`printf "%s\n%s\n%s\n%s" "$POWER_OFF" "$REBOOT" "$SUSPEND" "$LOG_OUT" | rofi -dmenu -i -p ""`
|
|
|
|
chosen=`printf "%s\n%s\n%s\n%s\n%s" "$POWER_OFF" "$REBOOT" "$SUSPEND" "$LOCK" "$LOG_OUT" | rofi -dmenu -i -p ""`
|
|
|
|
|
|
|
|
|
|
|
|
case "$chosen" in
|
|
|
|
case "$chosen" in
|
|
|
|
$POWER_OFF) action="power off" ;;
|
|
|
|
$POWER_OFF) action="power off" ;;
|
|
|
|
$REBOOT) action="reboot" ;;
|
|
|
|
$REBOOT) action="reboot" ;;
|
|
|
|
$SUSPEND) action="suspend" ;;
|
|
|
|
$SUSPEND) action="suspend" ;;
|
|
|
|
|
|
|
|
$LOCK) action="lock" ;;
|
|
|
|
$LOG_OUT) action="log out" ;;
|
|
|
|
$LOG_OUT) action="log out" ;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
@ -20,7 +22,7 @@ if [[ $sure != $confirm ]]; then
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $chosen != $SUSPEND ]]; then
|
|
|
|
if [[ $chosen != $SUSPEND ]] && [[ $chosen != $LOCK ]]; then
|
|
|
|
# based on https://github.com/ardadem/graceful-shutdown
|
|
|
|
# based on https://github.com/ardadem/graceful-shutdown
|
|
|
|
|
|
|
|
|
|
|
|
TIMEOUT=10
|
|
|
|
TIMEOUT=10
|
|
|
@ -61,7 +63,8 @@ fi
|
|
|
|
case "$chosen" in
|
|
|
|
case "$chosen" in
|
|
|
|
$POWER_OFF) poweroff ;;
|
|
|
|
$POWER_OFF) poweroff ;;
|
|
|
|
$REBOOT) reboot ;;
|
|
|
|
$REBOOT) reboot ;;
|
|
|
|
$SUSPEND) systemctl suspend ;;
|
|
|
|
$SUSPEND) dm-tool switch-to-greeter && systemctl suspend ;;
|
|
|
|
|
|
|
|
$LOCK) dm-tool lock ;;
|
|
|
|
$LOG_OUT) i3-msg exit ;;
|
|
|
|
$LOG_OUT) i3-msg exit ;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|