python-specbar / README.rst

Statusbar for spectrwm is a small library to use with the spectrwm window manager. It has some builtin info functions and is easy extensible using the Python decorator syntax.


# Extending with own info function
>>> import specbar
>>> @specbar.info_collector(42)
>>> def get_something(num):
        return dict(square=num**2)
>>> specbar.loop(format_str='Square info: {square}')

That's it now your own function get's called every 5 (default) seconds and the format string is displayed in the statusbar.

Using builtin functions:

>>> import specbar
>>> specbar.register(specbar.get_gmail_count, 'myuser', 'mysecret')
>>> specbar.loop('New Mails: {gmail_count:<3}', 15)

Now every 15 seconds your Gmail account is checked for new mail and the result is displayed.