From 9514f1fb01d43d04bb65dbf40ace01e270494dc3 Mon Sep 17 00:00:00 2001 From: Kunal Shetye Date: Fri, 20 Apr 2018 06:34:35 +0200 Subject: [PATCH] Added a hidden method to hide mpd widget when no music is playing --- bumblebee/modules/mpd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bumblebee/modules/mpd.py b/bumblebee/modules/mpd.py index ae7fe64..ff8ecd5 100644 --- a/bumblebee/modules/mpd.py +++ b/bumblebee/modules/mpd.py @@ -55,6 +55,9 @@ class Module(bumblebee.engine.Module): self._repeat = False self._tags = defaultdict(lambda: '') + def hidden(self): + return self._status == None + @scrollable def description(self, widget): return string.Formatter().vformat(self._fmt, (), self._tags) @@ -80,6 +83,7 @@ class Module(bumblebee.engine.Module): except RuntimeError: pass self._tags = defaultdict(lambda: '') + self._status = None for line in info.split("\n"): if line.startswith("[playing]"): self._status = "playing"