[vega] Sets up working system. [Eww] Moves config to be specific to drew-desktop

This commit is contained in:
2025-03-28 10:28:10 -07:00
parent c95d3419a2
commit b241ccd7d8
21 changed files with 23 additions and 50 deletions

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
SOURCE='@DEFAULT_AUDIO_SOURCE@'
SINK='@DEFAULT_AUDIO_SINK@'
case $1 in
source)
device=$SOURCE
;;
sink)
device=$SINK
;;
*)
echo "Invalid device: $1"
echo "Valid options are 'source' and 'sink'"
exit 1
;;
esac
print_device_info() {
# The node description seems to be the most useful value here, though different values are available.
# However, we'll strip the "Analog Stereo" part.
description=$(wpctl inspect "$device" | sed -n -e 's/.*node.description = "\(.*\) Analog Stereo"/\1/p')
# The output of a muted device is something like "Volume: 0.55", so we just nab the second field.
volume=$(wpctl get-volume "$device" | awk '/Volume/ { print $2 }')
# The output of a muted device is something like "Volume: 0.55 [MUTED]", so "true" if the third field is present, "false" otherwise.
muted=$(wpctl get-volume "$device" | awk '/Volume/ { print ($3 ? "true" : "false") }')
echo "{ \"description\": \"$description\", \"volume\": $volume, \"muted\": $muted }"
}
print_device_info
pactl --format=json subscribe | grep --line-buffered $1 | while read -r event; do print_device_info; done