1
0
forked from extern/nix-config

yambar: Add pipewire script

This commit is contained in:
Donovan Glover 2023-04-30 13:50:22 -04:00
parent 08b5d9a72b
commit 7484827bb7
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -0,0 +1,29 @@
#!/bin/bash
declare pipewire
while true; do
pw="$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1)"
muted="$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 2)"
pw2="$(echo "$pw * 100 / 1" | bc)"
if [[ "$muted" == "[MUTED]" ]]; then
pipewire="$pw2"
else
if [[ "$pw2" -gt 59 ]]; then
pipewire="$pw2"
else
if [[ "$pw2" -gt 0 ]]; then
pipewire="$pw2"
else
pipewire="$pw2"
fi
fi
fi
printf -- '%s\n' "pipewire|string|${pipewire}%"
printf -- '%s\n' ""
sleep 0.1
done
unset pipewire