text: add cmd_leftclick and cmd_rightclick options
This commit is contained in:
parent
beff75b9c0
commit
69d33633f1
11
README.rst
11
README.rst
@ -55,6 +55,11 @@ Contributors
|
|||||||
* yemu
|
* yemu
|
||||||
* zzatkin
|
* zzatkin
|
||||||
|
|
||||||
|
3.30 (next version)
|
||||||
|
+++++++++++++++++++
|
||||||
|
|
||||||
|
* `text`_: add cmd_leftclick and cmd_rightclick options
|
||||||
|
|
||||||
3.29
|
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_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!``)
|
: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``)
|
: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``)
|
:color: The text color (default: ``#ffffff``)
|
||||||
:critical_color: The critical color (default: ``#ff0000``)
|
:critical_color: The critical color (default: ``#ff0000``)
|
||||||
:interval: (default: ``5``)
|
:interval: (default: ``5``)
|
||||||
@ -666,7 +671,7 @@ Settings:
|
|||||||
:host: (default: ``localhost``)
|
:host: (default: ``localhost``)
|
||||||
:port: MPD port (default: ``6600``)
|
:port: MPD port (default: ``6600``)
|
||||||
:format: formatp string (default: ``{title} {status}``)
|
: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``)
|
:interval: (default: ``1``)
|
||||||
|
|
||||||
|
|
||||||
@ -869,6 +874,8 @@ Settings:
|
|||||||
|
|
||||||
:text: (required)
|
:text: (required)
|
||||||
:color: HTML color code #RRGGBB (default: ``None``)
|
: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``)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +55,11 @@ Contributors
|
|||||||
* yemu
|
* yemu
|
||||||
* zzatkin
|
* zzatkin
|
||||||
|
|
||||||
|
3.30 (next version)
|
||||||
|
+++++++++++++++++++
|
||||||
|
|
||||||
|
* `text`_: add cmd_leftclick and cmd_rightclick options
|
||||||
|
|
||||||
3.29
|
3.29
|
||||||
++++
|
++++
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import subprocess
|
||||||
|
|
||||||
from i3pystatus import Module
|
from i3pystatus import Module
|
||||||
|
|
||||||
|
|
||||||
@ -9,10 +11,14 @@ class Text(Module):
|
|||||||
settings = (
|
settings = (
|
||||||
"text",
|
"text",
|
||||||
("color", "HTML color code #RRGGBB"),
|
("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",)
|
required = ("text",)
|
||||||
|
|
||||||
color = None
|
color = None
|
||||||
|
cmd_leftclick = "test"
|
||||||
|
cmd_rightclick = "test"
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.output = {
|
self.output = {
|
||||||
@ -20,3 +26,10 @@ class Text(Module):
|
|||||||
}
|
}
|
||||||
if self.color:
|
if self.color:
|
||||||
self.output["color"] = 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user