X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/8d37b9a1e4521a220f20ce2e1414f656aa3a5015..0ef82f83e0baaa2936b6204a24ee3b3b638fd409:/widgets/mem.lua diff --git a/widgets/mem.lua b/widgets/mem.lua index d0ff223..f014149 100644 --- a/widgets/mem.lua +++ b/widgets/mem.lua @@ -25,14 +25,14 @@ local setmetatable = setmetatable -- lain.widgets.mem local mem = {} -function worker(args) +local function worker(args) local args = args or {} local timeout = args.timeout or 3 local settings = args.settings or function() end - widget = wibox.widget.textbox('') + mem.widget = wibox.widget.textbox('') - function update() + function mem.update() mem = {} for line in io.lines("/proc/meminfo") do @@ -51,12 +51,13 @@ function worker(args) used = mem.total - (mem.free + mem.buf + mem.cache) swapused = mem.swap - mem.swapf + widget = mem.widget settings() end - newtimer("mem", timeout, update) + newtimer("mem", timeout, mem.update) - return widget + return mem.widget end return setmetatable(mem, { __call = function(_, ...) return worker(...) end })