X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/eb8cec907a50f3fd6df4b14ae10b910444017f92..a6965bed5eea11416503e17fb1b419724dff7b84:/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 })