summaryrefslogtreecommitdiff
path: root/bin/monitor-volume
blob: cbbb69d6e59be2d7347255d176c0e4af60bae97c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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