.dotfiles/.bin/menu-shutdown

27 lines
540 B
Bash
Executable file

#!/bin/sh
actions="backup-shutdown
shutdown
reboot
soft-reboot
logout
autostart"
action=$(echo "$actions" | $DMENU)
_menu_shutdown_backup() {
alacritty -e sh -c "autorestic backup -av && sleep 3"
}
if [ -z "$action" ]; then
exit 1
fi
case "$action" in
"backup-shutdown") _menu_shutdown_backup && systemctl poweroff -i ;;
"shutdown") systemctl poweroff -i ;;
"reboot") systemctl reboot ;;
"soft-reboot") systemctl soft-reboot ;;
"logout") systemctl --user exit ;;
"autostart") autostart-manage run ;;
"*") ;; esac