aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-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)
+