mirror of
https://github.com/imgurbot12/rmenu.git
synced 2025-01-27 05:18:33 +01:00
feat: minor plugin tweaks and fixes
This commit is contained in:
parent
faa7fea0fd
commit
b13f3cc9ce
3 changed files with 22 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
#/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
get_sinks() {
|
get_sinks() {
|
||||||
sinks=`pactl list sinks | grep -e 'Sink' -e 'Name' -e 'Description' | nl -s '>'`
|
sinks=`pactl list sinks | grep -e 'Sink' -e 'Name' -e 'Description' | nl -s '>'`
|
||||||
|
|
|
@ -4,19 +4,28 @@ SELF=`realpath $0`
|
||||||
THEME=`realpath "$(dirname $0)/themes/powermenu.css"`
|
THEME=`realpath "$(dirname $0)/themes/powermenu.css"`
|
||||||
RMENU=${RMENU:-"rmenu"}
|
RMENU=${RMENU:-"rmenu"}
|
||||||
|
|
||||||
options() {
|
#: desc => generate options for basic operation
|
||||||
|
main_options() {
|
||||||
rmenu-build options \
|
rmenu-build options \
|
||||||
-t $THEME \
|
-t $THEME \
|
||||||
-n ArrowRight -p ArrowLeft \
|
-n ArrowRight -p ArrowLeft \
|
||||||
-w 550 -h 150 -M 0
|
-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
|
#: desc => generate confirmation entries
|
||||||
#: usage => $cmd $name?
|
#: usage => $cmd $name?
|
||||||
confirm() {
|
confirm() {
|
||||||
cmd=$1
|
cmd=$1
|
||||||
name="${2:-"Confirm"}"
|
name="${2:-"Confirm"}"
|
||||||
options
|
confirm_options
|
||||||
rmenu-build entry -n "Cancel" -I "" -a "`rmenu-build action -m echo "$name Cancelled"`"
|
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"`"
|
rmenu-build entry -n "$name" -I "" -a "`rmenu-build action "$cmd"`"
|
||||||
}
|
}
|
||||||
|
@ -46,13 +55,8 @@ action() {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"list")
|
"help")
|
||||||
confirm="$2"
|
echo "usage: $0 <args...>" && exit 1
|
||||||
options
|
|
||||||
action "⏻" "Shutdown" "systemctl poweroff" "$2"
|
|
||||||
action "" "Reboot" "systemctl reboot" "$2"
|
|
||||||
action "⏾" "Suspend" "systemctl suspend" "$2"
|
|
||||||
action "" "Log Out" "sway exit" "$2"
|
|
||||||
;;
|
;;
|
||||||
"confirm")
|
"confirm")
|
||||||
name=`echo $2 | cut -d ':' -f1`
|
name=`echo $2 | cut -d ':' -f1`
|
||||||
|
@ -60,6 +64,11 @@ case "$1" in
|
||||||
confirm "$action" "$name" | $RMENU
|
confirm "$action" "$name" | $RMENU
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: $0 <list|confirm> <args...>" && 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
|
esac
|
||||||
|
|
|
@ -34,11 +34,11 @@ plugins:
|
||||||
cache: false
|
cache: false
|
||||||
placeholder: "Jump to the Specified Window"
|
placeholder: "Jump to the Specified Window"
|
||||||
audio:
|
audio:
|
||||||
exec: ["sh", "~/.config/rmenu/pactl-audio.sh"]
|
exec: ["~/.config/rmenu/pactl-audio.sh"]
|
||||||
cache: false
|
cache: false
|
||||||
placeholder: "Select an Audio Sink"
|
placeholder: "Select an Audio Sink"
|
||||||
powermenu:
|
powermenu:
|
||||||
exec: ["sh", "~/.config/rmenu/powermenu.sh", "list", "confirm"]
|
exec: ["~/.config/rmenu/powermenu.sh"]
|
||||||
cache: false
|
cache: false
|
||||||
|
|
||||||
# custom keybindings
|
# custom keybindings
|
||||||
|
|
Loading…
Reference in a new issue