Dotfiles/bin/.bin/dmenu/rofi-shutdown
Jonathan Hodgson a6e3cd71d4 Fixes rofi shutdown command
I use an alias rather than an expanded variable so I can include an
empty parameter.

The rofi shutdown command now only needs a single click to select an
option
2021-02-25 09:55:11 +00:00

43 lines
694 B
Bash
Executable file

#!/usr/bin/sh
if type -p rofi 2> /dev/null; then
alias selectcommand="rofi -dmenu -i -theme themes/four.rasi -me-select-entry '' -me-accept-entry MousePrimary"
shutdown=""
reboot=""
lock=""
suspend=""
logout="﫼"
else
alias selectcommand="dmenu -i -p 'Option'"
shutdown="Shutdown"
reboot="Reboot"
lock="Lock"
suspend="Suspend"
logout="Logout"
fi
selection=$( \
echo -e "$shutdown\n$reboot\n$lock\n$logout\n$suspend" | selectcommand
);
echo $selection;
sleep .2
case $selection in
$lock)
#i3exit lock
;;
$logout)
pkill dwm
;;
$suspend)
systemctl suspend
#i3exit lock
;;
$reboot)
systemctl reboot
;;
$shutdown)
systemctl poweroff
;;
esac