dotfiles/files/bin/rofi-powermenu
2020-04-07 22:22:18 +01:00

34 lines
662 B
Bash
Executable file

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