X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/fa69c1ae7ffc2ab3955d0c6812beb1de0c1226a0..a58e36385cbd3f177134210386a6e6232d673a17:/widgets/pulseaudio.lua diff --git a/widgets/pulseaudio.lua b/widgets/pulseaudio.lua index 4bda3c5..45981f3 100644 --- a/widgets/pulseaudio.lua +++ b/widgets/pulseaudio.lua @@ -9,11 +9,9 @@ local read_pipe = require("lain.helpers").read_pipe local newtimer = require("lain.helpers").newtimer local wibox = require("wibox") - local string = { gmatch = string.gmatch, match = string.match, format = string.format } - local setmetatable = setmetatable -- PulseAudio volume @@ -26,15 +24,16 @@ local function worker(args) local settings = args.settings or function() end local scallback = args.scallback - pulseaudio.cmd = args.cmd or string.format("pacmd list-sinks | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p'") - pulseaudio.widget = wibox.widget.textbox('') + pulseaudio.cmd = args.cmd or string.format("pacmd list-sinks | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'") + pulseaudio.widget = wibox.widget.textbox() function pulseaudio.update() if scallback then pulseaudio.cmd = scallback() end local s = read_pipe(pulseaudio.cmd) volume_now = {} - volume.now.index = string.match(s, "index: (%S+)") or "N/A" + volume_now.index = string.match(s, "index: (%S+)") or "N/A" + volume_now.sink = string.match(s, "device.string = \"(%S+)\"") or "N/A" volume_now.muted = string.match(s, "muted: (%S+)") or "N/A" local ch = 1