aboutsummaryrefslogblamecommitdiffstats
path: root/examples/plugins/clock
blob: 4cf1b21e73a9a4afbde2b737a32354796aa57884 (plain) (tree)


























                                                                                          
# -*- 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)