diff --git a/README.rst b/README.rst index 84b9d35..6cce317 100644 --- a/README.rst +++ b/README.rst @@ -55,6 +55,11 @@ Contributors * yemu * zzatkin +3.30 (next version) ++++++++++++++++++++ + +* `text`_: add cmd_leftclick and cmd_rightclick options + 3.29 ++++ @@ -379,7 +384,7 @@ Settings: :alert_format_title: The title of the notification, all formatters can be used (default: ``Low battery``) :alert_format_body: The body text of the notification, all formatters can be used (default: ``Battery {battery_ident} has only {percentage:.2f}% ({remaining:%E%hh:%Mm}) remaining!``) :path: Override the default-generated path (default: ``None``) -:status: A dictionary mapping ('DIS', 'CHR', 'FULL') to alternative names (default: ``{'CHR': 'CHR', 'DIS': 'DIS', 'FULL': 'FULL'}``) +:status: A dictionary mapping ('DIS', 'CHR', 'FULL') to alternative names (default: ``{'DIS': 'DIS', 'FULL': 'FULL', 'CHR': 'CHR'}``) :color: The text color (default: ``#ffffff``) :critical_color: The critical color (default: ``#ff0000``) :interval: (default: ``5``) @@ -666,7 +671,7 @@ Settings: :host: (default: ``localhost``) :port: MPD port (default: ``6600``) :format: formatp string (default: ``{title} {status}``) -:status: Dictionary mapping pause, play and stop to output (default: ``{'stop': '◾', 'pause': '▷', 'play': '▶'}``) +:status: Dictionary mapping pause, play and stop to output (default: ``{'play': '▶', 'stop': '◾', 'pause': '▷'}``) :interval: (default: ``1``) @@ -869,6 +874,8 @@ Settings: :text: (required) :color: HTML color code #RRGGBB (default: ``None``) +:cmd_leftclick: Shell command to execute on left click (default: ``test``) +:cmd_rightclick: Shell command to execute on right click (default: ``test``) diff --git a/README.tpl.rst b/README.tpl.rst index 44e7983..24aca9b 100644 --- a/README.tpl.rst +++ b/README.tpl.rst @@ -55,6 +55,11 @@ Contributors * yemu * zzatkin +3.30 (next version) ++++++++++++++++++++ + +* `text`_: add cmd_leftclick and cmd_rightclick options + 3.29 ++++ diff --git a/i3pystatus/text.py b/i3pystatus/text.py index 44b964b..74d05ff 100644 --- a/i3pystatus/text.py +++ b/i3pystatus/text.py @@ -1,3 +1,5 @@ +import subprocess + from i3pystatus import Module @@ -9,10 +11,14 @@ class Text(Module): settings = ( "text", ("color", "HTML color code #RRGGBB"), + ("cmd_leftclick", "Shell command to execute on left click"), + ("cmd_rightclick", "Shell command to execute on right click"), ) required = ("text",) color = None + cmd_leftclick = "test" + cmd_rightclick = "test" def init(self): self.output = { @@ -20,3 +26,10 @@ class Text(Module): } if self.color: self.output["color"] = self.color + + + def on_leftclick(self): + subprocess.call(self.cmd_leftclick, shell=True) + + def on_rightclick(self): + subprocess.call(self.cmd_rightclick, shell=True)