sway: update status to toggle pavucontrol
This commit is contained in:
parent
0a8b578f52
commit
72f543bac4
4 changed files with 16 additions and 0 deletions
13
bin/volume
13
bin/volume
|
@ -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\""
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue