update docs (#699)

This commit is contained in:
chestm007 2019-01-08 01:45:13 +11:00 committed by GitHub
parent 75409ce9ad
commit cf5b4576a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -358,6 +358,24 @@ If ``self`` is needed to access the calling module, the
on_rightclick = change_text,
)
If the module your attaching the callback too is not a subclass of
:py:class:`.IntervalModule` you will need to invoke ``init()``.
using :py:class:`.Uname` as an example, the following code would suffice.
.. code:: python
from i3pystatus import get_module
@get_module
def sys_info(self):
if self.format == "{nodename}":
self.format = "{sysname} {release} on {machine}"
else:
self.format = "{nodename}"
self.init()
status.register("uname", format="{nodename}", on_rightclick=sys_info)
You can also create callbacks with parameters.
.. code:: python