summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/monitor-volume17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/monitor-volume b/bin/monitor-volume
new file mode 100755
index 0000000..cbbb69d
--- /dev/null
+++ b/bin/monitor-volume
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+pw-dump --monitor | jq -r --unbuffered '
+ .[]
+ | select(
+ .type? == "PipeWire:Interface:Node"
+ and (.info?."change-mask"? | any(. == "params"))
+ and .info?.props."media.class" == "Audio/Sink"
+ and .info?.params.Props != null
+ )
+ | .info.params.Props
+ | .[]
+ | select(.channelVolumes != null)
+ | .channelVolumes[0]
+' | while read -r v; do
+ printf '%.0f\n' "$(printf 'e(l(%f)/3)*100\n' "$v" | bc -l 2>/dev/null)" 2>/dev/null || true
+done