diff --git a/yambar/.config/yambar/pipewire.sh b/yambar/.config/yambar/pipewire.sh new file mode 100755 index 00000000..e5f5d2e5 --- /dev/null +++ b/yambar/.config/yambar/pipewire.sh @@ -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