51 lines
814 B
Bash
51 lines
814 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
prompt="Are you sure?"
|
||
|
mesg="Uptime : `uptime -p | sed -e 's/up //g'`"
|
||
|
|
||
|
option_1=""
|
||
|
option_2=""
|
||
|
option_3=""
|
||
|
option_4=""
|
||
|
option_5=""
|
||
|
|
||
|
yes=''
|
||
|
no=''
|
||
|
|
||
|
|
||
|
rofi_powermenu() {
|
||
|
echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5" | rofi -dmenu -p "$prompt" -mesg "$mesg" -markup-rows -theme powermenu
|
||
|
}
|
||
|
|
||
|
|
||
|
confirm_run () {
|
||
|
selected="$(~/.config/bspwm/scripts/confirm.sh)"
|
||
|
|
||
|
if [[ "$selected" == "$yes" ]]; then
|
||
|
${1}
|
||
|
else
|
||
|
echo $selected, $1
|
||
|
exit
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
|
||
|
chosen="$(rofi_powermenu)"
|
||
|
|
||
|
case ${chosen} in
|
||
|
$option_1)
|
||
|
xflock4 --lock
|
||
|
;;
|
||
|
$option_2)
|
||
|
confirm_run 'bspc quit'
|
||
|
;;
|
||
|
$option_3)
|
||
|
confirm_run 'systemctl hibernate'
|
||
|
;;
|
||
|
$option_4)
|
||
|
confirm_run 'systemctl reboot'
|
||
|
;;
|
||
|
$option_5)
|
||
|
confirm_run 'ssytemctl poweroff'
|
||
|
;;
|
||
|
esac
|