X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/79687bad24e8b782fca0e4270e282a10f3bd56c3..09c0a3f27b6c0b61a55e7875b9a967e98cd3daf8:/widgets/pulseaudio.lua?ds=sidebyside 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