sway: update status to toggle pavucontrol

This commit is contained in:
Konstantin Koslowski 2021-01-04 17:37:20 +01:00
parent 0a8b578f52
commit 72f543bac4
4 changed files with 16 additions and 0 deletions

View file

@ -1,12 +1,22 @@
#!/bin/bash #!/bin/bash
sink=$(pacmd list-sinks | grep "* index" | grep -oE '[0-9]*') sink=$(pacmd list-sinks | grep "* index" | grep -oE '[0-9]*')
cmd="" cmd=""
app="pavucontrol"
if [ -z "$sink" ]; then if [ -z "$sink" ]; then
echo "ERROR: invalid sink: \"$sink\"" echo "ERROR: invalid sink: \"$sink\""
exit 1 exit 1
fi fi
function _toggle() {
a=$1
if [ $(pgrep $a) ]; then
killall $a
else
$a &> /dev/null &
fi
}
case $1 in case $1 in
d*) d*)
pactl set-sink-volume $sink -5% pactl set-sink-volume $sink -5%
@ -17,6 +27,9 @@ case $1 in
m*) m*)
pactl set-sink-mute $sink toggle pactl set-sink-mute $sink toggle
;; ;;
gui)
_toggle $app
;;
*) *)
echo "ERROR: invalid command: \"$1\"" echo "ERROR: invalid command: \"$1\""
;; ;;

View file

@ -41,6 +41,7 @@ interface_name_include = []
[[block]] [[block]]
block = "sound" block = "sound"
step_width = 3 step_width = 3
on_click = "$HOME/.config/sway/bin/volume gui"
[[block]] [[block]]
block = "bluetooth" block = "bluetooth"

View file

@ -41,6 +41,7 @@ interface_name_include = []
[[block]] [[block]]
block = "sound" block = "sound"
step_width = 3 step_width = 3
on_click = "$HOME/.config/sway/bin/volume gui"
[[block]] [[block]]
block = "music" block = "music"

View file

@ -41,6 +41,7 @@ interface_name_include = []
[[block]] [[block]]
block = "sound" block = "sound"
step_width = 3 step_width = 3
on_click = "$HOME/.config/sway/bin/volume gui"
[[block]] [[block]]
block = "music" block = "music"