X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/8d3868d7ce528cfc075e246c8935bae2724e0868..fc6e880da40668c6e9bd9da3786ff2fcae519c75:/widget/mem.lua?ds=inline diff --git a/widget/mem.lua b/widget/mem.lua index 74ebad0..50fff3b 100644 --- a/widget/mem.lua +++ b/widget/mem.lua @@ -7,24 +7,19 @@ --]] -local helpers = require("lain.helpers") -local wibox = require("wibox") -local gmatch = string.gmatch -local lines = io.lines -local floor = math.floor -local setmetatable = setmetatable +local helpers = require("lain.helpers") +local wibox = require("wibox") +local gmatch, lines, floor = string.gmatch, io.lines, math.floor -- Memory usage (ignoring caches) -- lain.widget.mem -local mem = {} -local function worker(args) +local function factory(args) + local mem = { widget = wibox.widget.textbox() } local args = args or {} local timeout = args.timeout or 2 local settings = args.settings or function() end - mem.widget = wibox.widget.textbox() - function mem.update() mem_now = {} for line in lines("/proc/meminfo") do @@ -53,4 +48,4 @@ local function worker(args) return mem end -return setmetatable(mem, { __call = function(_, ...) return worker(...) end }) +return factory