From 4dbe53fab66a970b76089d85c472df0ed3180c09 Mon Sep 17 00:00:00 2001 From: Alessandro Date: Sat, 18 Jun 2022 14:28:50 +0200 Subject: [PATCH] Pipewire watch recipe --- recipes/watch.mdwn | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/recipes/watch.mdwn b/recipes/watch.mdwn index 3399a74..7022490 100644 --- a/recipes/watch.mdwn +++ b/recipes/watch.mdwn @@ -146,6 +146,24 @@ local mpris, mpris_timer = awful.widget.watch( ) ``` +## pipewire +```lua +-- pactl based volume widget for pure pipewire setups +local volume = awful.widget.watch( + "pactl get-sink-volume @DEFAULT_SINK@ | cut -s -d/ -f2,4; pactl get-sink-mute @DEFAULT_SINK@", + 5, -- timeout + function(widget, stdout) + local volume = "Volume: " + for v in stdout:gmatch("(%d+%%)") do volume = volume .. " " .. v end + if #volume == 8 then volume = "N/A" end + local mute = string.match(stdout, "Mute: (%S+)") or "N/A" + + -- customize here + widget:set_markup(volume .. " " .. mute) + end +) +``` + ## upower ```lua