X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/eb8cec907a50f3fd6df4b14ae10b910444017f92..19ea09feadacb8b67d5c0900224259aa01c0c71b:/widgets/cpu.lua?ds=inline diff --git a/widgets/cpu.lua b/widgets/cpu.lua index f9bbe72..f307b26 100644 --- a/widgets/cpu.lua +++ b/widgets/cpu.lua @@ -31,9 +31,9 @@ local function worker(args) local timeout = args.timeout or 5 local settings = args.settings or function() end - widget = wibox.widget.textbox('') + cpu.widget = wibox.widget.textbox('') - function update() + function cpu.update() -- Read the amount of time the CPUs have spent performing -- different kinds of work. Read the first line of /proc/stat -- which is the sum of all CPUs. @@ -60,6 +60,7 @@ local function worker(args) usage = tostring(math.ceil((dactive / dtotal) * 100)) + widget = cpu.widget settings() -- Save current data for the next run. @@ -67,9 +68,9 @@ local function worker(args) cpu.last_total = total end - newtimer("cpu", timeout, update) + newtimer("cpu", timeout, cpu.update) - return widget + return cpu.widget end return setmetatable(cpu, { __call = function(_, ...) return worker(...) end })