Add get-volume script

This commit is contained in:
Victor Timofei 2023-06-14 18:31:33 +03:00
parent 39bbf3529a
commit 02cc4ed11c
Signed by: vtimofei
GPG Key ID: B790DCEBE281403A
1 changed files with 17 additions and 0 deletions

17
.config/eww/scripts/get-volume Executable file
View File

@ -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