From 7484827bb7b1de5af627fc3c1892b2486d0d0847 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 30 Apr 2023 13:50:22 -0400 Subject: [PATCH] yambar: Add pipewire script --- yambar/.config/yambar/pipewire.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 yambar/.config/yambar/pipewire.sh 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