Module: Added hints setting that allows the user to add additional i3bar protocol blocks to module's output.

This commit is contained in:
Lukáš Mandák 2015-06-06 14:15:48 +02:00
parent 33c4172ee5
commit 8d80b375a3

View File

@ -13,6 +13,7 @@ class Module(SettingsBase):
('on_rightclick', "Callback called on right click (string)"), ('on_rightclick', "Callback called on right click (string)"),
('on_upscroll', "Callback called on scrolling up (string)"), ('on_upscroll', "Callback called on scrolling up (string)"),
('on_downscroll', "Callback called on scrolling down (string)"), ('on_downscroll', "Callback called on scrolling down (string)"),
('hints', "Additional hints for module. TODO"),
) )
on_leftclick = None on_leftclick = None
@ -20,6 +21,12 @@ class Module(SettingsBase):
on_upscroll = None on_upscroll = None
on_downscroll = None on_downscroll = None
hints = None
"""
TODO
`min_width`, `align`, `separator`, `separator_block_width`
"""
def registered(self, status_handler): def registered(self, status_handler):
"""Called when this module is registered with a status handler""" """Called when this module is registered with a status handler"""
@ -30,6 +37,9 @@ class Module(SettingsBase):
self.output["instance"] = str(id(self)) self.output["instance"] = str(id(self))
if (self.output.get("color", "") or "").lower() == "#ffffff": if (self.output.get("color", "") or "").lower() == "#ffffff":
del self.output["color"] del self.output["color"]
if self.hints:
h = {i: self.hints[i] for i in self.hints if i not in self.output}
self.output.update(h)
json.insert(convert_position(self.position, json), self.output) json.insert(convert_position(self.position, json), self.output)
def run(self): def run(self):