aboutsummaryrefslogtreecommitdiff
path: root/.config/polybar/scripts/powermenu.sh
diff options
context:
space:
mode:
Diffstat (limited to '.config/polybar/scripts/powermenu.sh')
-rwxr-xr-x.config/polybar/scripts/powermenu.sh32
1 files changed, 20 insertions, 12 deletions
diff --git a/.config/polybar/scripts/powermenu.sh b/.config/polybar/scripts/powermenu.sh
index 271006d..7b229ae 100755
--- a/.config/polybar/scripts/powermenu.sh
+++ b/.config/polybar/scripts/powermenu.sh
@@ -5,10 +5,10 @@
## Github : @adi1090x
## Twitter : @adi1090x
-dir="~/.config/polybar/forest/scripts/rofi"
+dir="~/.config/polybar/scripts/rofi"
uptime=$(uptime -p | sed -e 's/up //g')
-rofi_command="rofi -theme $dir/powermenu.rasi"
+rofi_command="rofi -no-config -theme $dir/powermenu.rasi"
# Options
shutdown=" Shutdown"
@@ -17,9 +17,19 @@ lock=" Lock"
suspend=" Sleep"
logout=" Logout"
+# Confirmation
+confirm_exit() {
+ rofi -dmenu\
+ -no-config\
+ -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"
+ rofi -no-config -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n"
}
# Variable passed to rofi
@@ -30,7 +40,7 @@ case $chosen in
$shutdown)
ans=$(confirm_exit &)
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
- loginctl poweroff
+ systemctl poweroff
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else
@@ -40,7 +50,7 @@ case $chosen in
$reboot)
ans=$(confirm_exit &)
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
- loginctl reboot
+ systemctl reboot
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else
@@ -48,16 +58,14 @@ case $chosen in
fi
;;
$lock)
- if [[ -f /usr/bin/i3lock ]]; then
- i3lock
- elif [[ -f /usr/bin/betterlockscreen ]]; then
- betterlockscreen -l
- fi
- ;;
+ ~/.config/i3lock/lock.sh
+ ;;
$suspend)
ans=$(confirm_exit &)
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
- ZZZ
+ mpc -q pause
+ amixer set Master mute
+ systemctl suspend
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else