dotfiles/files/bin/rofi-powermenu

34 lines
615 B
Text
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="$power_off\n$reboot\n$lock\n$suspend\n$log_out"
chosen="$(echo -e "$options" | rofi -dmenu -p Shutdown? -no-custom -lines 5)"
case $chosen in
$power_off)
systemctl poweroff
;;
$reboot)
systemctl reboot
;;
$lock)
xdotool key "Super_L+l"
;;
$suspend)
systemctl suspend
;;
$log_out)
i3-msg exit
;;
esac