summaryrefslogtreecommitdiff
path: root/awesome/rc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'awesome/rc.lua')
-rw-r--r--awesome/rc.lua20
1 files changed, 5 insertions, 15 deletions
diff --git a/awesome/rc.lua b/awesome/rc.lua
index 5af88d9..1288238 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -172,26 +172,16 @@ for bat = 0, 1 do
end
end
-function cpu_string()
- local f = io.open("/proc/cpuinfo", "r")
- local n = 2
- local result = " CPU:$2%"
- if f then
- f:read() -- skip first line/processor
- for line in f:lines() do
- m = string.match(line, "processor\t*: %d+")
- if m then
- n = n + 1
- result = result .. "/$" .. n .. "%"
- end
- end
- f:close()
+function cpu_string(widget, loads)
+ local result = " CPU:" .. loads[1] .. "%"
+ for cpu = 2, #loads-1 do
+ result = result .. "/" .. loads[cpu] .. "%"
end
return result .. " "
end
cpuwidget = wibox.widget.textbox()
-vicious.register(cpuwidget, vicious.widgets.cpu, cpu_string(), 2)
+vicious.register(cpuwidget, vicious.widgets.cpu, cpu_string, 2)
-- Create a wibox for each screen and add it
local taglist_buttons = awful.util.table.join(