diff --git a/bumblebee_status/modules/contrib/mpd.py b/bumblebee_status/modules/contrib/mpd.py index 3efffff..92568d1 100644 --- a/bumblebee_status/modules/contrib/mpd.py +++ b/bumblebee_status/modules/contrib/mpd.py @@ -94,6 +94,12 @@ class Module(core.module.Module): "cmd": "mpc toggle" + self._hostcmd, } widget.full_text(self.description) + elif widget_name == "mpd.toggle": + widget_map[widget] = { + "button": core.input.LEFT_MOUSE, + "cmd": "mpc toggle" + self._hostcmd, + } + widget.full_text(self.toggle) elif widget_name == "mpd.next": widget_map[widget] = { "button": core.input.LEFT_MOUSE, @@ -127,6 +133,9 @@ class Module(core.module.Module): def description(self, widget): return string.Formatter().vformat(self._fmt, (), self._tags) + def toggle(self, widget): + return str(util.cli.execute("mpc status %currenttime%/%totaltime%", ignore_errors=True)).strip() + def update(self): self._load_song() diff --git a/bumblebee_status/modules/contrib/title.py b/bumblebee_status/modules/contrib/title.py index 33af47a..055369e 100644 --- a/bumblebee_status/modules/contrib/title.py +++ b/bumblebee_status/modules/contrib/title.py @@ -9,6 +9,7 @@ Parameters: * title.max : Maximum character length for title before truncating. Defaults to 64. * title.placeholder : Placeholder text to be placed if title was truncated. Defaults to '...'. * title.scroll : Boolean flag for scrolling title. Defaults to False + * title.short : Boolean flag for short title. Defaults to False contributed by `UltimatePancake `_ - many thanks! @@ -35,6 +36,7 @@ class Module(core.module.Module): # parsing of parameters self.__scroll = util.format.asbool(self.parameter("scroll", False)) + self.__short = util.format.asbool(self.parameter("short", False)) self.__max = int(self.parameter("max", 64)) self.__placeholder = self.parameter("placeholder", "...") self.__title = "" @@ -66,7 +68,9 @@ class Module(core.module.Module): def __pollTitle(self): """Updating current title.""" try: - self.__full_title = self.__i3.get_tree().find_focused().name + focused = self.__i3.get_tree().find_focused().name + self.__full_title = focused.split( + "-")[-1].strip() if self.__short else focused except: self.__full_title = no_title if self.__full_title is None: