#!/bin/sh

actions="backup-shutwdown
shutdown
reboot
logout
autostart"
action=$(echo "$actions" | $DMENU)

_menu_shutdown_backup() {
	alacritty -e "host-backup"
}

if [ -z "$action" ]; then
	exit 1
fi

notify-send "$(user-cleaner)"

case "$action" in
	backup-shutwdown)	_menu_shutdown_backup && systemctl poweroff -i ;;
	shutdown)	systemctl poweroff -i ;;
	reboot)		systemctl reboot ;;
	logout)		systemctl --user exit ;;
	autostart)	autostart-manage run ;;
	*)			;; esac