54 lines
845 B
Bash
54 lines
845 B
Bash
#!/bin/bash
|
|
|
|
prompt="Select the action..."
|
|
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)"
|
|
|
|
if [[ "$selected" == "$yes" ]]; then
|
|
${1}
|
|
else
|
|
exit
|
|
fi
|
|
}
|
|
|
|
xlock () {
|
|
~/.local/bin/scripts/xlock --lock
|
|
}
|
|
|
|
|
|
chosen="$(rofi_powermenu)"
|
|
|
|
case ${chosen} in
|
|
$option_1)
|
|
xlock
|
|
;;
|
|
$option_2)
|
|
confirm_run 'bspc quit'
|
|
;;
|
|
$option_3)
|
|
confirm_run 'xlock && systemctl hibernate'
|
|
;;
|
|
$option_4)
|
|
confirm_run 'systemctl reboot'
|
|
;;
|
|
$option_5)
|
|
confirm_run 'ssytemctl poweroff'
|
|
;;
|
|
esac |