aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugins/clock
blob: 4cf1b21e73a9a4afbde2b737a32354796aa57884 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)