From a5d68067cfa5759bf55576784563092b5ca5629f Mon Sep 17 00:00:00 2001 From: Luke Bonham Date: Fri, 24 Feb 2017 13:48:13 +0100 Subject: [PATCH] add .device for pulseaudio and pulsebar; wiki updated; closes #323 --- widget/pulseaudio.lua | 9 ++++++--- widget/pulsebar.lua | 3 +++ wiki | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/widget/pulseaudio.lua b/widget/pulseaudio.lua index 6c1344d..b0946a1 100644 --- a/widget/pulseaudio.lua +++ b/widget/pulseaudio.lua @@ -19,12 +19,13 @@ local string = { gmatch = string.gmatch, local function factory(args) local pulseaudio = { widget = wibox.widget.textbox() } local args = args or {} - local devicetype = args.devicetype or "sink" local timeout = args.timeout or 5 local settings = args.settings or function() end local scallback = args.scallback - - pulseaudio.cmd = args.cmd or "pacmd list-" .. devicetype .. "s | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'" + + pulseaudio.device = "N/A" + pulseaudio.devicetype = args.devicetype or "sink" + pulseaudio.cmd = args.cmd or "pacmd list-" .. pulseaudio.devicetype .. "s | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'" function pulseaudio.update() if scallback then pulseaudio.cmd = scallback() end @@ -37,6 +38,8 @@ local function factory(args) muted = string.match(s, "muted: (%S+)") or "N/A" } + pulseaudio.device = volume_now.index + local ch = 1 volume_now.channel = {} for v in string.gmatch(s, ":.-(%d+)%%") do diff --git a/widget/pulsebar.lua b/widget/pulsebar.lua index e96658b..74765f5 100644 --- a/widget/pulsebar.lua +++ b/widget/pulsebar.lua @@ -48,6 +48,7 @@ local function factory(args) pulsebar.colors = args.colors or pulsebar.colors pulsebar.followtag = args.followtag or false pulsebar.notifications = args.notification_preset + pulseaudio.device = "N/A" if not pulsebar.notification_preset then pulsebar.notification_preset = {} @@ -78,6 +79,8 @@ local function factory(args) muted = string.match(s, "muted: (%S+)") or "N/A" } + pulseaudio.device = volume_now.index + local ch = 1 volume_now.channel = {} for v in string.gmatch(s, ":.-(%d+)%%") do diff --git a/wiki b/wiki index 9a0c980..b1fd348 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 9a0c9808e8054e5cc31d1293608f052a3b2d9f25 +Subproject commit b1fd3487839584af9accc28a73a6aac7914d6b45 -- 2.39.2