mirror of
https://github.com/imgurbot12/rmenu.git
synced 2024-11-10 11:33:48 +01:00
feat: minor plugin tweaks and fixes
This commit is contained in:
parent
faa7fea0fd
commit
b13f3cc9ce
@ -1,4 +1,4 @@
|
||||
#/bin/sh
|
||||
#!/bin/sh
|
||||
|
||||
get_sinks() {
|
||||
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"`
|
||||
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 <args...>" && exit 1
|
||||
;;
|
||||
"confirm")
|
||||
name=`echo $2 | cut -d ':' -f1`
|
||||
@ -60,6 +64,11 @@ case "$1" in
|
||||
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user