aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugins/kmsg
blob: bb2ddffcc83099ae3fd6c8c7ef27227a15a196e1 (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
28
29
30
# -*- python -*-

# A xpybar configuration example testing the features of plugins.kmsg

from plugins.kmsg import KMsg


OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True

text = ''
kmsg_ = KMsg()

start_ = start
def start():
    start_()
    def refresh():
        global text
        text = kmsg_.next()
        if text is None:
            text = ''
            bar.invalidate()
            import sys
            sys.exit() # kill thread
        bar.invalidate()
    async(lambda : forever(refresh))

def redraw():
    bar.clear()
    bar.draw_coloured_text(0, 10, 0, 2, text)