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