From b13f3cc9ce2f93d32bf7c695cd0d92b887212d84 Mon Sep 17 00:00:00 2001 From: imgurbot12 Date: Sat, 19 Aug 2023 21:20:20 -0700 Subject: [PATCH] feat: minor plugin tweaks and fixes --- other-plugins/pactl-audio.sh | 2 +- other-plugins/powermenu.sh | 29 +++++++++++++++++++---------- rmenu/public/config.yaml | 4 ++-- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/other-plugins/pactl-audio.sh b/other-plugins/pactl-audio.sh index 92b6843..bb61f04 100755 --- a/other-plugins/pactl-audio.sh +++ b/other-plugins/pactl-audio.sh @@ -1,4 +1,4 @@ -#/bin/sh +#!/bin/sh get_sinks() { sinks=`pactl list sinks | grep -e 'Sink' -e 'Name' -e 'Description' | nl -s '>'` diff --git a/other-plugins/powermenu.sh b/other-plugins/powermenu.sh index a7eb302..5565194 100755 --- a/other-plugins/powermenu.sh +++ b/other-plugins/powermenu.sh @@ -4,19 +4,28 @@ SELF=`realpath $0` THEME=`realpath "$(dirname $0)/themes/powermenu.css"` RMENU=${RMENU:-"rmenu"} -options() { +#: desc => generate options for basic operation +main_options() { rmenu-build options \ -t $THEME \ -n ArrowRight -p ArrowLeft \ -w 550 -h 150 -M 0 } +#: desc => generate options for confirm operation +confirm_options() { + rmenu-build options \ + -t $THEME \ + -n ArrowRight -p ArrowLeft \ + -w 300 -h 150 -M 0 +} + #: desc => generate confirmation entries #: usage => $cmd $name? confirm() { cmd=$1 name="${2:-"Confirm"}" - options + confirm_options rmenu-build entry -n "Cancel" -I "" -a "`rmenu-build action -m echo "$name Cancelled"`" rmenu-build entry -n "$name" -I "" -a "`rmenu-build action "$cmd"`" } @@ -46,13 +55,8 @@ action() { } case "$1" in - "list") - confirm="$2" - options - action "⏻" "Shutdown" "systemctl poweroff" "$2" - action "" "Reboot" "systemctl reboot" "$2" - action "⏾" "Suspend" "systemctl suspend" "$2" - action "" "Log Out" "sway exit" "$2" + "help") + echo "usage: $0 " && exit 1 ;; "confirm") name=`echo $2 | cut -d ':' -f1` @@ -60,6 +64,11 @@ case "$1" in confirm "$action" "$name" | $RMENU ;; *) - echo "usage: $0 " && exit 1 + [ "$1" != "--no-confirm" ] && confirm="Y" + main_options + action "⏻" "Shutdown" "systemctl poweroff" "$confirm" + action "" "Reboot" "systemctl reboot" "$confirm" + action "⏾" "Suspend" "systemctl suspend" "$confirm" + action "" "Log Out" "sway exit" "$confirm" ;; esac diff --git a/rmenu/public/config.yaml b/rmenu/public/config.yaml index ba6eda1..54d931b 100644 --- a/rmenu/public/config.yaml +++ b/rmenu/public/config.yaml @@ -34,11 +34,11 @@ plugins: cache: false placeholder: "Jump to the Specified Window" audio: - exec: ["sh", "~/.config/rmenu/pactl-audio.sh"] + exec: ["~/.config/rmenu/pactl-audio.sh"] cache: false placeholder: "Select an Audio Sink" powermenu: - exec: ["sh", "~/.config/rmenu/powermenu.sh", "list", "confirm"] + exec: ["~/.config/rmenu/powermenu.sh"] cache: false # custom keybindings