diff --git a/bumblebee_status/core/module.py b/bumblebee_status/core/module.py index c4b66a4..312862d 100644 --- a/bumblebee_status/core/module.py +++ b/bumblebee_status/core/module.py @@ -95,6 +95,8 @@ class Module(core.input.Object): self.alias = self.__config.get("__alias__", None) self.id = self.alias if self.alias else self.name self.next_update = None + self.minimized = False + self.minimized = self.parameter("start-minimized", False) self.theme = theme @@ -126,6 +128,8 @@ class Module(core.input.Object): for prefix in [self.name, self.module_name, self.alias]: value = self.__config.get("{}.{}".format(prefix, key), value) + if self.minimized: + value = self.__config.get("{}.minimized.{}".format(prefix, key), value) return value """Set a parameter for this module diff --git a/bumblebee_status/core/output.py b/bumblebee_status/core/output.py index 9c032d6..121df27 100644 --- a/bumblebee_status/core/output.py +++ b/bumblebee_status/core/output.py @@ -166,6 +166,12 @@ class i3(object): def toggle_minimize(self, event): widget_id = event["instance"] + for module in self.__modules: + if module.widget(widget_id=widget_id) and util.format.asbool(module.parameter("minimize", False)) == True: + # this module can customly minimize + module.minimized = not module.minimized + return + if widget_id in self.__content: self.__content[widget_id]["minimized"] = not self.__content[widget_id]["minimized"] @@ -216,6 +222,10 @@ class i3(object): def blocks(self, module): blocks = [] + if module.minimized: + blocks.extend(self.separator_block(module, module.widgets()[0])) + blocks.append(self.__content_block(module, module.widgets()[0])) + return blocks for widget in module.widgets(): if widget.module and self.__config.autohide(widget.module.name): if not any( diff --git a/bumblebee_status/modules/core/datetime.py b/bumblebee_status/modules/core/datetime.py index f421e15..febb5fb 100644 --- a/bumblebee_status/modules/core/datetime.py +++ b/bumblebee_status/modules/core/datetime.py @@ -21,7 +21,6 @@ class Module(core.module.Module): super().__init__(config, theme, core.widget.Widget(self.full_text)) core.input.register(self, button=core.input.LEFT_MOUSE, cmd="calendar") - self._fmt = self.parameter("format", self.default_format()) l = locale.getdefaultlocale() if not l or l == (None, None): l = ("en_US", "UTF-8") @@ -36,7 +35,8 @@ class Module(core.module.Module): def full_text(self, widget): enc = locale.getpreferredencoding() - retval = datetime.datetime.now().strftime(self._fmt) + fmt = self.parameter("format", self.default_format()) + retval = datetime.datetime.now().strftime(fmt) if hasattr(retval, "decode"): return retval.decode(enc) return retval