完成电源按钮的配置

master
yutent 2023-07-06 11:44:39 +00:00
parent 43f3b424ac
commit 2cec4a0485
5 changed files with 63 additions and 11 deletions

View File

View File

@ -0,0 +1,6 @@
#!/bin/bash
yes=''
no=''
echo -e "$yes\n$no" | rofi -dmenu -p 'Are you Sure?' -theme confirm

View File

@ -0,0 +1,51 @@
#!/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

View File

@ -40,7 +40,7 @@ fixed-center = true
modules-left = logo workspace pipe-db mpd
modules-center = date
modules-right = netspeed volume pipe hibernate pipe logout
modules-right = netspeed volume pipe power
tray-position = right

View File

@ -1,14 +1,9 @@
[module/hibernate]
[module/power]
type = custom/text
;click-left = lxsession-logout -p ""
content = %{T9}%{T-}
content-foreground = ${color.yellow}
[module/logout]
type = custom/text
;click-left = lxsession-logout -p ""
content = %{T9}襤%{T-}
content-foreground = ${color.red}
content-padding = 2
content-padding = 2
click-left = ~/.config/bspwm/scripts/powermenu.sh