eww(bar,cc): add a lot of scripts and modify existing

This commit is contained in:
retrozinndev
2024-12-07 16:42:49 -03:00
parent e27e70891c
commit adf8b7d9ba
5 changed files with 98 additions and 40 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
sink_="@DEFAULT_AUDIO_SINK@"
source_="@DEFAULT_AUDIO_SOURCE@"
print_json() {
echo "{ \"output\": $output_vol, \"source\": $source_vol }"
}
get_vol() {
echo $(wpctl get-volume $1 | awk "{print int(\$2*100)}")
}
output_vol=$(get_vol $sink_)
source_vol=$(get_vol $source_)
print_json
pactl subscribe | grep --line-buffered -e "on sink" -e "on source" | while read -r; do
output_vol=$(get_vol $sink_)
source_vol=$(get_vol $source_)
print_json
done