X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/ddbf283f0ebbc6772d485fe76c5dccf338d3b837..133fe63b85978ac1f21658c5decd66e269261e60:/widgets/cpu.lua diff --git a/widgets/cpu.lua b/widgets/cpu.lua index f61e2cc..076b692 100644 --- a/widgets/cpu.lua +++ b/widgets/cpu.lua @@ -17,16 +17,16 @@ local setmetatable = setmetatable -- CPU usage -- lain.widgets.cpu -local cpu = helpers.make_widget_textbox() +local cpu = { core = {} } local function worker(args) local args = args or {} local timeout = args.timeout or 2 local settings = args.settings or function() end - cpu.core = {} + 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. @@ -67,14 +67,14 @@ local function worker(args) end end - widget = cpu.widget cpu_now = cpu.core cpu_now.usage = cpu_now[0].usage + widget = cpu.widget settings() end - helpers.newtimer("cpu", timeout, update) + helpers.newtimer("cpu", timeout, cpu.update) return cpu end