X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/c0deea25035a845907210f2a913099343a16162e..434d5f32aa3a19763bf6bb2eed40f881fd918309:/widgets/pulseaudio.lua?ds=sidebyside diff --git a/widgets/pulseaudio.lua b/widgets/pulseaudio.lua index f2d63d6..8e89ffd 100644 --- a/widgets/pulseaudio.lua +++ b/widgets/pulseaudio.lua @@ -16,7 +16,7 @@ local setmetatable = setmetatable -- PulseAudio volume -- lain.widgets.pulseaudio -local pulseaudio = {} +local pulseaudio = helpers.make_widget_textbox() local function worker(args) local args = args or {} @@ -25,7 +25,6 @@ local function worker(args) local scallback = args.scallback pulseaudio.cmd = args.cmd or "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 @@ -52,9 +51,9 @@ local function worker(args) end) end - helpers.newtimer(string.format("pulseaudio-%s", timeout), timeout, pulseaudio.update) + helpers.newtimer("pulseaudio", timeout, pulseaudio.update) - return setmetatable(pulseaudio, { __index = pulseaudio.widget }) + return pulseaudio end return setmetatable(pulseaudio, { __call = function(_, ...) return worker(...) end })