-function worker(args)
- local args = args or {}
- local refresh_timeout = args.refresh_timeout or 10
- local show_swap = args.show_swap or false
- local show_total = args.show_total or false
- local header = args.header or " Mem "
- local header_color = args.header or beautiful.fg_normal or "#FFFFFF"
- local color = args.color or beautiful.fg_focus or "#FFFFFF"
- local footer = args.footer or "MB"
-
- local widg = wibox.widget.textbox()
-
- local upd = function()
- local mem = {}
- for line in io.lines("/proc/meminfo")
- do
- for k, v in string.gmatch(line, "([%a]+):[%s]+([%d]+).+")
- do
- if k == "MemTotal" then mem.total = math.floor(v / 1024)
- elseif k == "MemFree" then mem.free = math.floor(v / 1024)
- elseif k == "Buffers" then mem.buf = math.floor(v / 1024)
- elseif k == "Cached" then mem.cache = math.floor(v / 1024)
- elseif k == "SwapTotal" then mem.swap = math.floor(v / 1024)
- elseif k == "SwapFree" then mem.swapf = math.floor(v / 1024)
+local function worker(args)
+ local args = args or {}
+ local timeout = args.timeout or 2
+ local settings = args.settings or function() end
+
+ mem.widget = wibox.widget.textbox()
+
+ function update()
+ mem_now = {}
+ for line in io.lines("/proc/meminfo") do
+ for k, v in string.gmatch(line, "([%a]+):[%s]+([%d]+).+") do
+ if k == "MemTotal" then mem_now.total = math.floor(v / 1024)
+ elseif k == "MemFree" then mem_now.free = math.floor(v / 1024)
+ elseif k == "Buffers" then mem_now.buf = math.floor(v / 1024)
+ elseif k == "Cached" then mem_now.cache = math.floor(v / 1024)
+ elseif k == "SwapTotal" then mem_now.swap = math.floor(v / 1024)
+ elseif k == "SwapFree" then mem_now.swapf = math.floor(v / 1024)