Update .config/polybar/scripts/powermenu.sh
This commit is contained in:
parent
4c013e0fa1
commit
1c3faf7b8a
1 changed files with 54 additions and 58 deletions
|
@ -5,7 +5,7 @@
|
|||
## Github : @adi1090x
|
||||
## Twitter : @adi1090x
|
||||
|
||||
dir="~/.config/polybar/mytheme/scripts/rofi"
|
||||
dir="$HOME/.config/polybar/scripts/rofi"
|
||||
uptime=$(uptime -p | sed -e 's/up //g')
|
||||
|
||||
rofi_command="rofi -no-config -theme $dir/powermenu.rasi"
|
||||
|
@ -19,11 +19,7 @@ logout=" Logout"
|
|||
|
||||
# Confirmation
|
||||
confirm_exit() {
|
||||
rofi -dmenu\
|
||||
-no-config\
|
||||
-i\
|
||||
-no-fixed-num-lines\
|
||||
-p "Are You Sure? : "\
|
||||
rofi -dmenu -no-config -i -no-fixed-num-lines -p "Are You Sure? : " \
|
||||
-theme $dir/confirm.rasi
|
||||
}
|
||||
|
||||
|
@ -37,7 +33,7 @@ options="$lock\n$suspend\n$logout\n$reboot\n$shutdown"
|
|||
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
|
||||
case $chosen in
|
||||
$shutdown)
|
||||
$shutdown)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl poweroff
|
||||
|
@ -47,7 +43,7 @@ case $chosen in
|
|||
msg
|
||||
fi
|
||||
;;
|
||||
$reboot)
|
||||
$reboot)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
systemctl reboot
|
||||
|
@ -57,12 +53,12 @@ case $chosen in
|
|||
msg
|
||||
fi
|
||||
;;
|
||||
$lock)
|
||||
$lock)
|
||||
if [[ -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
|
||||
|
@ -74,7 +70,7 @@ case $chosen in
|
|||
msg
|
||||
fi
|
||||
;;
|
||||
$logout)
|
||||
$logout)
|
||||
ans=$(confirm_exit &)
|
||||
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
|
||||
if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
|
||||
|
|
Loading…
Reference in a new issue