[modules] add a module "keys" that shows whether a key is pressed
also, add backend functionality to hide individual widgets of a module.
This commit is contained in:
parent
7d0d1455c8
commit
8d88b23947
4 changed files with 46 additions and 28 deletions
|
@ -190,9 +190,9 @@ class Module(core.input.Object):
|
||||||
:rtype: bumblebee_status.widget.Widget
|
:rtype: bumblebee_status.widget.Widget
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def add_widget(self, full_text="", name=None):
|
def add_widget(self, full_text="", name=None, hidden=False):
|
||||||
widget_id = "{}::{}".format(self.name, len(self.widgets()))
|
widget_id = "{}::{}".format(self.name, len(self.widgets()))
|
||||||
widget = core.widget.Widget(full_text=full_text, name=name, widget_id=widget_id)
|
widget = core.widget.Widget(full_text=full_text, name=name, widget_id=widget_id, hidden=hidden)
|
||||||
self.widgets().append(widget)
|
self.widgets().append(widget)
|
||||||
widget.module = self
|
widget.module = self
|
||||||
return widget
|
return widget
|
||||||
|
|
|
@ -216,6 +216,8 @@ class i3(object):
|
||||||
continue
|
continue
|
||||||
if module.hidden():
|
if module.hidden():
|
||||||
continue
|
continue
|
||||||
|
if widget.hidden:
|
||||||
|
continue
|
||||||
if "critical" in widget.state() and self.__config.errorhide(widget.module.name):
|
if "critical" in widget.state() and self.__config.errorhide(widget.module.name):
|
||||||
continue
|
continue
|
||||||
blocks.extend(self.separator_block(module, widget))
|
blocks.extend(self.separator_block(module, widget))
|
||||||
|
|
|
@ -10,12 +10,13 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Widget(util.store.Store, core.input.Object):
|
class Widget(util.store.Store, core.input.Object):
|
||||||
def __init__(self, full_text="", name=None, widget_id=None):
|
def __init__(self, full_text="", name=None, widget_id=None, hidden=False):
|
||||||
super(Widget, self).__init__()
|
super(Widget, self).__init__()
|
||||||
self.__full_text = full_text
|
self.__full_text = full_text
|
||||||
self.module = None
|
self.module = None
|
||||||
self.name = name
|
self.name = name
|
||||||
self.id = widget_id or self.id
|
self.id = widget_id or self.id
|
||||||
|
self.hidden = hidden
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def module(self):
|
def module(self):
|
||||||
|
|
|
@ -68,5 +68,20 @@
|
||||||
"fg": "#002b36",
|
"fg": "#002b36",
|
||||||
"bg": "#859900"
|
"bg": "#859900"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"keys": {
|
||||||
|
"Key.cmd": {
|
||||||
|
"bg": "#8ec07c",
|
||||||
|
"full_text": "***"
|
||||||
|
},
|
||||||
|
"Key.shift": {
|
||||||
|
"bg": "#fabd2f"
|
||||||
|
},
|
||||||
|
"Key.ctrl": {
|
||||||
|
"bg": "#83a598"
|
||||||
|
},
|
||||||
|
"Key.alt": {
|
||||||
|
"bg": "#f28019"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue