dotfiles/files/bin/rofi-powermenu

35 lines
662 B
Plaintext
Raw Normal View History

2019-10-06 21:21:59 +01:00
#!/usr/bin/env bash
## Modified from https://gitlab.com/vahnrr/rofi-menus/blob/master/scripts/powermenu.sh
set -e
power_off="Power Off"
reboot="Reboot"
lock="Lock"
suspend="Suspend"
log_out="Log Out"
options="Do Nothing\n$power_off\n$reboot\n$lock\n$suspend\n$log_out"
2019-10-06 21:21:59 +01:00
chosen="$(echo -e "$options" | rofi -dmenu -p Shutdown? -no-custom -lines 5)"
case $chosen in
$power_off)
2019-10-07 14:19:59 +01:00
systemctl poweroff -i
2019-10-06 21:21:59 +01:00
;;
$reboot)
systemctl reboot
;;
$lock)
xdotool key "Super_L+l"
;;
$suspend)
2019-10-07 14:19:59 +01:00
xdotool key "Super_L+l"
2019-10-06 21:21:59 +01:00
systemctl suspend
;;
$log_out)
i3-msg exit
;;
esac