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
|
||||
sink=$(pacmd list-sinks | grep "* index" | grep -oE '[0-9]*')
|
||||
cmd=""
|
||||
app="pavucontrol"
|
||||
|
||||
if [ -z "$sink" ]; then
|
||||
echo "ERROR: invalid sink: \"$sink\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function _toggle() {
|
||||
a=$1
|
||||
if [ $(pgrep $a) ]; then
|
||||
killall $a
|
||||
else
|
||||
$a &> /dev/null &
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
d*)
|
||||
pactl set-sink-volume $sink -5%
|
||||
|
@ -17,6 +27,9 @@ case $1 in
|
|||
m*)
|
||||
pactl set-sink-mute $sink toggle
|
||||
;;
|
||||
gui)
|
||||
_toggle $app
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: invalid command: \"$1\""
|
||||
;;
|
||||
|
|
|
@ -41,6 +41,7 @@ interface_name_include = []
|
|||
[[block]]
|
||||
block = "sound"
|
||||
step_width = 3
|
||||
on_click = "$HOME/.config/sway/bin/volume gui"
|
||||
|
||||
[[block]]
|
||||
block = "bluetooth"
|
||||
|
|
|
@ -41,6 +41,7 @@ interface_name_include = []
|
|||
[[block]]
|
||||
block = "sound"
|
||||
step_width = 3
|
||||
on_click = "$HOME/.config/sway/bin/volume gui"
|
||||
|
||||
[[block]]
|
||||
block = "music"
|
||||
|
|
|
@ -41,6 +41,7 @@ interface_name_include = []
|
|||
[[block]]
|
||||
block = "sound"
|
||||
step_width = 3
|
||||
on_click = "$HOME/.config/sway/bin/volume gui"
|
||||
|
||||
[[block]]
|
||||
block = "music"
|
||||
|
|
Loading…
Reference in a new issue