dotfiles/bspwm/power.sh

29 lines
433 B
Bash
Raw Normal View History

2020-08-01 19:13:25 +00:00
#!/bin/sh
sure() {
2020-08-03 18:59:39 +00:00
options="Yes\nNo"
2020-08-01 19:13:25 +00:00
chosen=`echo "$options" | dmenu -i -p "Are you sure?" -sb red -sf black`
case "$chosen" in
Yes) exec $1 ;;
No) exit ;;
esac
}
options="shutdown
reboot
hibernate
sleep"
chosen=`echo "$options" | dmenu -i`
case "$chosen" in
shutdown)
sure "systemctl poweroff" ;;
reboot)
sure "systemctl reboot" ;;
hibernate)
sure "systemctl hibernate" ;;
sleep)
systemctl suspend ;;
esac