Support for the 3rd version of the i3bar-onclick-patch
This commit is contained in:
parent
657bdb826a
commit
375ba3af7b
@ -41,7 +41,7 @@ class Status:
|
|||||||
if j["command"] == "block_clicked":
|
if j["command"] == "block_clicked":
|
||||||
module = self.modules.get_by_id(j["instance"])
|
module = self.modules.get_by_id(j["instance"])
|
||||||
if module:
|
if module:
|
||||||
module.on_click()
|
module.on_click(j["button"])
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
for j in io.JSONIO(self.io).read():
|
for j in io.JSONIO(self.io).read():
|
||||||
|
@ -21,7 +21,16 @@ class Module(SettingsBase):
|
|||||||
self.output["instance"] = str(id(self))
|
self.output["instance"] = str(id(self))
|
||||||
json.insert(0, self.output)
|
json.insert(0, self.output)
|
||||||
|
|
||||||
def on_click(self):
|
def on_click(self, button):
|
||||||
|
if button == 1: # Left mouse button
|
||||||
|
self.on_leftclick()
|
||||||
|
elif button == 3: # Right mouse button
|
||||||
|
self.on_rightclick()
|
||||||
|
|
||||||
|
def on_leftclick(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def on_rightclick(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -87,5 +87,5 @@ class ModsDeChecker(IntervalModule):
|
|||||||
self.opener.addheaders.append(("Cookie", "{}={}".format(cookie.name, cookie.value)))
|
self.opener.addheaders.append(("Cookie", "{}={}".format(cookie.name, cookie.value)))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_click(self):
|
def on_leftclick(self):
|
||||||
webbrowser.open_new_tab("http://forum.mods.de/bb/")
|
webbrowser.open_new_tab("http://forum.mods.de/bb/")
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# PyPI: netifaces-py3
|
# PyPI: netifaces-py3
|
||||||
import netifaces
|
import netifaces
|
||||||
@ -61,7 +62,7 @@ class Network(IntervalModule):
|
|||||||
("interface", "Interface to obtain information for, i.e. eth0"),
|
("interface", "Interface to obtain information for, i.e. eth0"),
|
||||||
"format_up", "color_up",
|
"format_up", "color_up",
|
||||||
"format_down", "color_down",
|
"format_down", "color_down",
|
||||||
"name"
|
"name",
|
||||||
)
|
)
|
||||||
|
|
||||||
name = interface = "eth0"
|
name = interface = "eth0"
|
||||||
@ -113,3 +114,6 @@ class Network(IntervalModule):
|
|||||||
"color": color,
|
"color": color,
|
||||||
"instance": self.interface
|
"instance": self.interface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def on_leftclick(self):
|
||||||
|
subprocess.Popen(["nm-connection-editor"])
|
||||||
|
@ -64,5 +64,5 @@ class ParcelTracker(IntervalModule):
|
|||||||
"instance": self.name,
|
"instance": self.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_click(self):
|
def on_leftclick(self):
|
||||||
webbrowser.open_new_tab(self.instance.get_url())
|
webbrowser.open_new_tab(self.instance.get_url())
|
||||||
|
Loading…
Reference in New Issue
Block a user