aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugins
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-07 00:16:52 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-07 00:16:52 +0100
commit20c1782f7865b5f96b1650a65097a0e2bdd1241e (patch)
tree188a29f7e1bfa05a0a08a8d6f015f00a03d8e71e /examples/plugins
parentchase demo (diff)
downloadxpybar-20c1782f7865b5f96b1650a65097a0e2bdd1241e.tar.gz
xpybar-20c1782f7865b5f96b1650a65097a0e2bdd1241e.tar.bz2
xpybar-20c1782f7865b5f96b1650a65097a0e2bdd1241e.tar.xz
fix and demo cpuonline
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples/plugins')
-rw-r--r--examples/plugins/cpuonline21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/plugins/cpuonline b/examples/plugins/cpuonline
new file mode 100644
index 0000000..1796b22
--- /dev/null
+++ b/examples/plugins/cpuonline
@@ -0,0 +1,21 @@
+# -*- python -*-
+
+# A xpybar configuration example testing the features of plugins.chase
+
+import time
+import threading
+
+from plugins.cpuonline import CPUOnline
+
+
+OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True
+
+
+def redraw():
+ cpu = CPUOnline()
+ s = lambda cpus : ', '.join([str(i) for i in cpus])
+ text = 'Online: %s │ Offline: %s │ Present: %s │ Possible: %s'
+ text %= s(cpu.online), s(cpu.offline), s(cpu.present), s(cpu.possible)
+ bar.clear()
+ bar.draw_coloured_text(0, 10, 0, 2, text)
+