dotfiles/.config/eww/scripts/get-volume.sh
2024-11-05 14:09:13 +01:00

8 lines
319 B
Bash
Executable file

#!/bin/bash
input=$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | awk '{print "{\"value\": " $2 * 100 ", \"muted\": " ($3 == "[MUTED]") "}"}')
output=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print "{\"value\": " $2 * 100 ", \"muted\": " ($3 == "[MUTED]") "}"}')
cat << EOF
{"input": $input, "output": $output}
EOF