help='Subscribe for i3 events.' ) parser.add_argument( '--bspwm', action='store_true', help='Subscribe for bspwm events.' ) parser.add_argument( '--nm', action='store_true', help='Subscribe for nm events.' ) args = parser.parse_args() powerline = BarPowerline() lock = Lock() modes = ['default'] monitors = [] write = get_unicode_writer(encoding='utf-8') def render(reschedule=False): if reschedule: Timer(30, render, kwargs={'reschedule': True}).start() global lock with lock: write(powerline.render(mode=modes[0], segment_info={'monitors': monitors})) write('\n') sys.stdout.flush() def update(evt): modes[0] = evt.change render()
from powerline.lib.encoding import get_unicode_writer if __name__ == '__main__': parser = ArgumentParser(description='Powerline lemonbar bindings.') parser.add_argument( '--i3', action='store_true', help='Subscribe for i3 events.' ) args = parser.parse_args() powerline = LemonbarPowerline() powerline.update_renderer() powerline.pl.warn("The 'bar' bindings are deprecated, please switch to 'lemonbar'") lock = Lock() modes = ['default'] write = get_unicode_writer(encoding='utf-8') def render(reschedule=False): if reschedule: Timer(0.5, render, kwargs={'reschedule': True}).start() global lock with lock: write(powerline.render(mode=modes[0])) write('\n') sys.stdout.flush() def update(evt): modes[0] = evt.change render()