X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/586c54a25750fd90d91c15ac8eb818b2613de582..2ddb55bc44dd0ea06e8caa40798d27f907169c07:/widget/pulseaudio.lua diff --git a/widget/pulseaudio.lua b/widget/pulseaudio.lua index 6c1344d..ed37cb5 100644 --- a/widget/pulseaudio.lua +++ b/widget/pulseaudio.lua @@ -17,14 +17,15 @@ local string = { gmatch = string.gmatch, -- lain.widget.pulseaudio local function factory(args) - local pulseaudio = { widget = wibox.widget.textbox() } + 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