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

59 lines
882 B
Bash
Executable File

#!/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/rofi_confirm.sh)"
if [[ "$selected" == "$yes" ]]; then
${1}
else
exit
fi
}
xlock () {
~/.local/bin/scripts/xlock.sh --lock
}
hibernate () {
xlock
systemctl hibernate
}
chosen="$(rofi_powermenu)"
case ${chosen} in
$option_1)
xlock
;;
$option_2)
confirm_run 'bspc quit'
;;
$option_3)
confirm_run 'hibernate'
;;
$option_4)
confirm_run 'systemctl reboot'
;;
$option_5)
confirm_run 'systemctl poweroff'
;;
esac
~~i3历险记~~, i3从入门到放弃, 转战bspwm
Shell 100%