aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugins
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-20 16:58:39 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-20 16:58:39 +0200
commit0d56006f78ec66b231b16e20d1466dc29391221c (patch)
tree36bb20f08fc3bc233f14ffe9b6d68408f72d7cec /examples/plugins
parenttypo (diff)
downloadxpybar-0d56006f78ec66b231b16e20d1466dc29391221c.tar.gz
xpybar-0d56006f78ec66b231b16e20d1466dc29391221c.tar.bz2
xpybar-0d56006f78ec66b231b16e20d1466dc29391221c.tar.xz
add files
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples/plugins')
-rw-r--r--examples/plugins/files34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/plugins/files b/examples/plugins/files
new file mode 100644
index 0000000..56b69fd
--- /dev/null
+++ b/examples/plugins/files
@@ -0,0 +1,34 @@
+# -*- python -*-
+
+# A xpybar configuration example testing the features of plugins.files
+
+import time
+import threading
+
+from plugins.files import Files
+from plugins.clock import Clock
+
+
+OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True
+
+
+clock = Clock(sync_to = Clock.SECONDS)
+
+start_ = start
+def start():
+ start_()
+ async(lambda : clock.continuous_sync(lambda : bar.invalidate()))
+
+
+def redraw():
+ files_ = Files()
+
+ data = [('Files', files_.nr_files),
+ ('Free', files_.nr_free_files),
+ ('Max', files_.file_max)]
+
+ text = ' │ '.join('%s: %i' % (text, value) for (text, value) in data)
+
+ bar.clear()
+ bar.draw_coloured_text(0, 10, 0, 2, text)
+