Want to contribute? Fork me on Codeberg.org!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
773 B

POWER_OFF=" Power Off"
REBOOT=" Reboot"
SUSPEND=" Suspend"
LOG_OUT=" Log out"
chosen=`printf "%s\n%s\n%s\n%s" "$POWER_OFF" "$REBOOT" "$SUSPEND" "$LOG_OUT" | rofi -dmenu -i -p ""`
case "$chosen" in
$POWER_OFF) action="power off" ;;
$REBOOT) action="reboot" ;;
$SUSPEND) action="suspend" ;;
$LOG_OUT) action="log out" ;;
*) exit 1 ;;
esac
confirm=`printf "Yes, %s" "$action"`
sure=`printf "%s\nNo, cancel" "$confirm" | rofi -dmenu -i -p "Are you sure"`
if [[ $sure != $confirm ]]; then
exit 1
fi
if [[ $chosen != $SUSPEND ]]; then
sh /home/elnu/scripts/graceful-shutdown/graceful_shutdown.sh
fi
case "$chosen" in
$POWER_OFF) sudo poweroff ;;
$REBOOT) sudo reboot ;;
$SUSPEND) sudo systemctl suspend ;;
$LOG_OUT) i3-msg exit ;;
*) exit 1 ;;
esac