0
0
Fork 0
mirror of https://github.com/stronk-dev/Tokyo-Night-Linux.git synced 2024-10-17 20:58:16 -04:00

Fix polybar power menu

This commit is contained in:
Marco van Dijk 2021-07-19 01:04:52 +02:00
parent a64f1b8d18
commit 30b3cc8dd9
2 changed files with 2 additions and 54 deletions

View file

@ -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 &)
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 i3-msg exit
fi
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else
msg
fi
;; ;;
esac esac

View file

@ -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;