aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugins
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-06 23:46:09 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-06 23:46:09 +0100
commit5676d16a459eb97159f10ba242211b1492cf543d (patch)
tree1ff4a5dd9f73b3b3c36e7e11ae81a55f8120951c /examples/plugins
parentfix and use xkb lock keys (diff)
downloadxpybar-5676d16a459eb97159f10ba242211b1492cf543d.tar.gz
xpybar-5676d16a459eb97159f10ba242211b1492cf543d.tar.bz2
xpybar-5676d16a459eb97159f10ba242211b1492cf543d.tar.xz
plugins.clock demo
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples/plugins')
-rw-r--r--examples/plugins/clock27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/plugins/clock b/examples/plugins/clock
new file mode 100644
index 0000000..4cf1b21
--- /dev/null
+++ b/examples/plugins/clock
@@ -0,0 +1,27 @@
+# -*- python -*-
+
+# A xpybar configuration example testing the features of plugins.clock
+
+import time
+import threading
+
+from plugins.clock import Clock
+
+
+OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True
+
+
+clock = Clock(format = '%Y-(%m)%b-%d %T, %a w%V, %Z', utc = True, sync_to = Clock.SECONDS)
+
+
+start_ = start
+def start():
+ start_()
+ async(lambda : clock.continuous_sync(lambda : bar.invalidate()))
+
+
+def redraw():
+ text = '%s (%f)' % (clock.read(), Clock.posix_time())
+ bar.clear()
+ bar.draw_coloured_text(0, 10, 0, 2, text)
+