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, 19 insertions, 1 deletions
diff --git a/awesome/rc.lua b/awesome/rc.lua
index 178bbcb..72f421a 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -140,8 +140,26 @@ 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()
+ end
+ return result .. " "
+end
+
cpuwidget = widget({ type = 'textbox', name = 'cpuwidget', align = 'right' })
-vicious.register(cpuwidget, vicious.widgets.cpu, ' CPU:$2%/$3%/$4%/$5% ', 2)
+vicious.register(cpuwidget, vicious.widgets.cpu, cpu_string(), 2)
-- Create a systray
mysystray = widget({ type = "systray" })