aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugins/tzclock
diff options
context:
space:
mode:
Diffstat (limited to 'examples/plugins/tzclock')
-rw-r--r--examples/plugins/tzclock33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/plugins/tzclock b/examples/plugins/tzclock
new file mode 100644
index 0000000..e4d4911
--- /dev/null
+++ b/examples/plugins/tzclock
@@ -0,0 +1,33 @@
+# -*- python -*-
+
+# A xpybar configuration example testing the features of plugins.tzclock
+
+from plugins.tzclock import TZClock
+
+
+OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True
+
+
+pacific = TZClock(timezone = 'US/Pacific', format = '%T %Z')
+central = TZClock(timezone = 'US/Central', format = '%T %Z')
+utc = TZClock(timezone = 'UTC', format = '%T %Z', sync_to = TZClock.SECONDS)
+sthlm = TZClock(timezone = 'Europe/Stockholm', format = '%T %Z')
+kalinin = TZClock(timezone = 'Europe/Kaliningrad', format = '%T %Z')
+tokyo = TZClock(timezone = 'Asia/Tokyo', format = '%T %Z')
+
+
+timezones = [pacific, central, utc, sthlm, kalinin, tokyo]
+
+
+start_ = start
+def start():
+ start_()
+ async(lambda : utc.continuous_sync(lambda : bar.invalidate()))
+
+
+def redraw():
+ time = TZClock.posix_time()
+ text = ' │ '.join([tz.from_posix_time(time) for tz in timezones])
+ bar.clear()
+ bar.draw_coloured_text(0, 10, 0, 2, text)
+