Add get-volume script
This commit is contained in:
parent
39bbf3529a
commit
02cc4ed11c
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
getvolume() {
|
||||||
|
volume=$(pactl list sinks | grep Volume | awk 'NR==1{print $5}' | sed 's/%//')
|
||||||
|
mute=$(pactl list sinks | grep Mute | awk 'NR==1{print $2}')
|
||||||
|
if [[ $mute == "yes" ]]; then
|
||||||
|
is_muted="true"
|
||||||
|
else
|
||||||
|
is_muted="false"
|
||||||
|
fi
|
||||||
|
echo "{\"value\": ${volume}, \"is_muted\": ${is_muted}}"
|
||||||
|
}
|
||||||
|
|
||||||
|
getvolume
|
||||||
|
pactl subscribe | grep -E 'sink|source' | while read -r line; do
|
||||||
|
getvolume
|
||||||
|
done
|
Loading…
Reference in New Issue