From e58013fb54b1b24810fe94b905c9827ac75394c1 Mon Sep 17 00:00:00 2001 From: Roy Dumblauskas Date: Sun, 2 Aug 2026 16:44:59 -0500 Subject: [PATCH] waybar scripts --- roy-config/waybar/config | 23 ++++++++++++++++++---- roy-config/waybar/scripts/select-sink.sh | 13 ++++++++++++ roy-config/waybar/scripts/select-source.sh | 13 ++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100755 roy-config/waybar/scripts/select-sink.sh create mode 100755 roy-config/waybar/scripts/select-source.sh diff --git a/roy-config/waybar/config b/roy-config/waybar/config index b6e0d48..d1a2c46 100755 --- a/roy-config/waybar/config +++ b/roy-config/waybar/config @@ -35,15 +35,30 @@ "format": "{:%d.%m.%Y | %H:%M:%S}", "interval": 1 }, - "wireplumber": { - "format": "\udb81\udd7e {volume}%", - "max-volume": 100, + "wireplumber#sink": { + "format": "{icon} {volume}%", + "format-muted": "\uf6a9", + "format-icons": [ + "\uf026", + "\uf027", + "\uf028" + ], + "on-click": "~/.config/waybar/scripts/select-sink.sh", + "on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", + "scroll-step": 5 + }, + "wireplumber#source": { + "node-type": "Audio/Source", + "format": "\uf130 {volume}%", + "format-muted": "\uf131", + "on-click": "~/.config/waybar/scripts/select-source.sh", + "on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle", "scroll-step": 5 }, "battery": { "bat": "BAT0", "interval": 60, - "format": "{icon} {capacity}%", + "format": "{icon} {capacity}%", "format-icons": [ "\uf244", "\uf243", diff --git a/roy-config/waybar/scripts/select-sink.sh b/roy-config/waybar/scripts/select-sink.sh new file mode 100755 index 0000000..6c794c3 --- /dev/null +++ b/roy-config/waybar/scripts/select-sink.sh @@ -0,0 +1,13 @@ +sink=$( + pw-dump | + jq -r ' + .[] + | select(.type == "PipeWire:Interface:Node") + | select(.info.props["media.class"] == "Audio/Sink") + | "\(.id)\t\(.info.props["node.description"] // .info.props["node.name"])" + ' | + wofi --dmenu | + cut -f1 +) + +[ -n "$sink" ] && wpctl set-default "$sink" diff --git a/roy-config/waybar/scripts/select-source.sh b/roy-config/waybar/scripts/select-source.sh new file mode 100755 index 0000000..a819270 --- /dev/null +++ b/roy-config/waybar/scripts/select-source.sh @@ -0,0 +1,13 @@ +sink=$( + pw-dump | + jq -r ' + .[] + | select(.type == "PipeWire:Interface:Node") + | select(.info.props["media.class"] == "Audio/Source") + | "\(.id)\t\(.info.props["node.description"] // .info.props["node.name"])" + ' | + wofi --dmenu | + cut -f1 +) + +[ -n "$sink" ] && wpctl set-default "$sink"