diff --git a/docs/changelog.rst b/docs/changelog.rst index 7afc382..70d8006 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -21,6 +21,8 @@ master branch * Log file name is now an option (``logfile`` of :py:class:`.Status`) * Server used for checking internet connectivity is now an option (``internet_check`` of :py:class:`.Status`) * Added double click support for click events +* Formatter data is now available with most modules for program callbacks +* Added :py:func:`.util.get_module` for advanced callbacks * :py:mod:`.dota2wins`: Now accepts usernames in place of a Steam ID * dota2wins: Changed win percentage to be a float * :py:mod:`.uptime`: Added days, hours, minutes, secs formatters diff --git a/docs/configuration.rst b/docs/configuration.rst index 57ad858..75485ae 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -370,6 +370,18 @@ consider creating an `python callback` or execute a script instead. on_rightclick = "firefox --new-window https://github.com/enkore/i3pystatus", ) +Most modules provide all the formatter data to program callbacks. The snippet below +demonstrates how this could be used, in this case XMessage will display a dialog box +showing verbose information about the network interface: + +.. code:: python + + status.register("network", + interface="eth0", + on_leftclick="ip addr show dev {interface} | xmessage -file -" + ) + + .. _hints: Hints diff --git a/i3pystatus/core/modules.py b/i3pystatus/core/modules.py index 2d6d9e4..d06cd8b 100644 --- a/i3pystatus/core/modules.py +++ b/i3pystatus/core/modules.py @@ -104,6 +104,7 @@ class Module(SettingsBase): self.__log_button_event(button, cb, args, "External command") if hasattr(self, "data"): args = [arg.format(**self.data) for arg in args] + cb = cb.format(**self.data) execute(cb + " " + " ".join(args), detach=True) # Notify status handler