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