wm-logs/home/local/bin/scripts/powermenu.sh

51 lines
855 B
Bash
Raw Normal View History

2023-07-06 19:44:39 +08:00
#!/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="$(~/.local/bin/scripts/confirm.sh)"
2023-07-06 19:44:39 +08:00
if [[ "$selected" == "$yes" ]]; then
${1}
else
echo $selected, $1
exit
fi
}
chosen="$(rofi_powermenu)"
case ${chosen} in
$option_1)
xscreensaver-command --lock
2023-07-06 19:44:39 +08:00
;;
$option_2)
confirm_run 'bspc quit'
;;
$option_3)
confirm_run 'xscreensaver-command --lock && systemctl hibernate'
2023-07-06 19:44:39 +08:00
;;
$option_4)
confirm_run 'systemctl reboot'
;;
$option_5)
confirm_run 'ssytemctl poweroff'
;;
esac