From cf5b4576a857af04576b609d717945d758f99d07 Mon Sep 17 00:00:00 2001 From: chestm007 Date: Tue, 8 Jan 2019 01:45:13 +1100 Subject: [PATCH] update docs (#699) --- docs/configuration.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index c4c7e2d..1b7daac 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -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