mirror of
https://github.com/stronk-dev/Tokyo-Night-Linux.git
synced 2025-04-24 23:45:10 +02:00
Fix polybar power menu
This commit is contained in:
parent
a64f1b8d18
commit
30b3cc8dd9
@ -17,78 +17,26 @@ lock=" Lock"
|
|||||||
suspend=" Sleep"
|
suspend=" Sleep"
|
||||||
logout=" Logout"
|
logout=" Logout"
|
||||||
|
|
||||||
# Confirmation
|
|
||||||
confirm_exit() {
|
|
||||||
rofi -dmenu\
|
|
||||||
-i\
|
|
||||||
-no-fixed-num-lines\
|
|
||||||
-p "Are You Sure? : "\
|
|
||||||
-theme $dir/confirm.rasi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Message
|
|
||||||
msg() {
|
|
||||||
rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Variable passed to rofi
|
# Variable passed to rofi
|
||||||
options="$lock\n$suspend\n$logout\n$reboot\n$shutdown"
|
options="$lock\n$suspend\n$logout\n$reboot\n$shutdown"
|
||||||
|
|
||||||
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
|
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
|
||||||
case $chosen in
|
case $chosen in
|
||||||
$shutdown)
|
$shutdown)
|
||||||
ans=$(confirm_exit &)
|
|
||||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
|
||||||
systemctl poweroff
|
systemctl poweroff
|
||||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
msg
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
$reboot)
|
$reboot)
|
||||||
ans=$(confirm_exit &)
|
|
||||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
|
||||||
systemctl reboot
|
systemctl reboot
|
||||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
msg
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
$lock)
|
$lock)
|
||||||
if [[ -f /usr/bin/i3lock ]]; then
|
|
||||||
i3lock
|
i3lock
|
||||||
elif [[ -f /usr/bin/betterlockscreen ]]; then
|
|
||||||
betterlockscreen -l
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
$suspend)
|
$suspend)
|
||||||
ans=$(confirm_exit &)
|
|
||||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
|
||||||
mpc -q pause
|
mpc -q pause
|
||||||
amixer set Master mute
|
amixer set Master mute
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
msg
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
$logout)
|
$logout)
|
||||||
ans=$(confirm_exit &)
|
i3-msg exit
|
||||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
|
||||||
if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
|
|
||||||
openbox --exit
|
|
||||||
elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then
|
|
||||||
bspc quit
|
|
||||||
elif [[ "$DESKTOP_SESSION" == "i3" ]]; then
|
|
||||||
i3-msg exit
|
|
||||||
fi
|
|
||||||
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
msg
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -25,7 +25,7 @@ window {
|
|||||||
transparency: "real";
|
transparency: "real";
|
||||||
background-color: @bg;
|
background-color: @bg;
|
||||||
text-color: @fg;
|
text-color: @fg;
|
||||||
border: 0px 0px 4px 0px;
|
border: 1px 3px 5px 1px;
|
||||||
border-color: @ac;
|
border-color: @ac;
|
||||||
border-radius: 0px;
|
border-radius: 0px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user