configuration.nix/packages/scripts/power-menu.sh

28 lines
397 B
Bash
Raw Normal View History

2023-04-06 01:27:09 +05:30
#!/bin/sh
set -eu
chpower() {
case "$1" in
"")
;;
Shutdown)
exec systemctl poweroff
;;
Reboot)
exec systemctl reboot
;;
Hibernate)
exec systemctl hibernate
;;
*)
notify-send -t 1500 -u low "Invalid Option"
;;
esac
}
OPTIONS="Shutdown\nReboot\nHibernate"
chpower "$(printf "%b" "$OPTIONS" | sort | ${dmenu} -p "Power Menu")"