Fix single string case & docs

This commit is contained in:
enkore 2016-01-27 20:15:59 +01:00
parent dec534ce81
commit 2aeda9c5e3
3 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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