aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-28 20:50:53 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-28 20:50:53 +0100
commitdb7cf58ac21627b5ad851c1e738725d824fceac7 (patch)
tree303fe45674985d96d6c251b04fbfe3a3b8f5fec3 /examples
parentadd support for simple arrows (diff)
downloadxpybar-db7cf58ac21627b5ad851c1e738725d824fceac7.tar.gz
xpybar-db7cf58ac21627b5ad851c1e738725d824fceac7.tar.bz2
xpybar-db7cf58ac21627b5ad851c1e738725d824fceac7.tar.xz
add uptime
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/plugin-test20
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/plugin-test b/examples/plugin-test
new file mode 100644
index 0000000..fda91aa
--- /dev/null
+++ b/examples/plugin-test
@@ -0,0 +1,20 @@
+# -*- python -*-
+
+# A simple xpybar configuration example that tests the plugins
+
+from plugins.uptime import Uptime
+
+OUTPUT, HEIGHT, YPOS, TOP = 0, 24, 24, True
+
+def redraw():
+ bar.clear()
+
+ uptime_ = Uptime()
+ uptime = '%id %02i:%02i:%0.2f' % uptime_.uptime
+ tot_idle = '%id %02i:%02i:%0.2f' % uptime_.total_idle
+ avg_idle = '%id %02i:%02i:%0.2f' % uptime_.average_idle
+
+ text = 'Uptime: %s │ Idle time: %s %s'
+ text %= (uptime, tot_idle, avg_idle)
+ bar.draw_coloured_text(0, 10, 0, 2, text)
+