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

28 lines
400 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"
2023-04-06 01:33:37 +05:30
chpower "$(printf "%b" "$OPTIONS" | sort | rofi -dmenu -p "Power Menu")"
2023-04-06 01:27:09 +05:30