X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/d9877c4bedca550478507f268f43e137e4454c24..434d5f32aa3a19763bf6bb2eed40f881fd918309:/widgets/mem.lua?ds=inline diff --git a/widgets/mem.lua b/widgets/mem.lua index e96dc1b..ff5816c 100644 --- a/widgets/mem.lua +++ b/widgets/mem.lua @@ -7,7 +7,7 @@ --]] -local newtimer = require("lain.helpers").newtimer +local helpers = require("lain.helpers") local wibox = require("wibox") local gmatch = string.gmatch local lines = io.lines @@ -16,15 +16,13 @@ local setmetatable = setmetatable -- Memory usage (ignoring caches) -- lain.widgets.mem -local mem = {} +local mem = helpers.make_widget_textbox() 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 lines("/proc/meminfo") do @@ -48,9 +46,9 @@ local function worker(args) settings() end - newtimer("mem", timeout, update) + helpers.newtimer("mem", timeout, update) - return setmetatable(mem, { __index = mem.widget }) + return mem end return setmetatable(mem, { __call = function(_, ...) return worker(...) end })