remove unnecessary playerctl calls to determine whether widgets should be hidden
This commit is contained in:
parent
93f3da1e08
commit
99bd2a81b6
1 changed files with 6 additions and 1 deletions
7
bumblebee_status/modules/contrib/playerctl.py
Executable file → Normal file
7
bumblebee_status/modules/contrib/playerctl.py
Executable file → Normal file
|
@ -34,6 +34,7 @@ class Module(core.module.Module):
|
||||||
self.background = True
|
self.background = True
|
||||||
|
|
||||||
self.__hide = util.format.asbool(self.parameter("hide", "false"));
|
self.__hide = util.format.asbool(self.parameter("hide", "false"));
|
||||||
|
self.__hidden = self.__hide
|
||||||
|
|
||||||
self.__layout = util.format.aslist(
|
self.__layout = util.format.aslist(
|
||||||
self.parameter(
|
self.parameter(
|
||||||
|
@ -87,7 +88,7 @@ class Module(core.module.Module):
|
||||||
core.input.register(widget, **callback_options)
|
core.input.register(widget, **callback_options)
|
||||||
|
|
||||||
def hidden(self):
|
def hidden(self):
|
||||||
return self.__hide and self.status() == None
|
return self.__hidden
|
||||||
|
|
||||||
def status(self):
|
def status(self):
|
||||||
try:
|
try:
|
||||||
|
@ -101,6 +102,10 @@ class Module(core.module.Module):
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
playback_status = self.status()
|
playback_status = self.status()
|
||||||
|
if not playback_status:
|
||||||
|
self.__hidden = self.__hide
|
||||||
|
else:
|
||||||
|
self.__hidden = False
|
||||||
for widget in self.widgets():
|
for widget in self.widgets():
|
||||||
if playback_status:
|
if playback_status:
|
||||||
if widget.name == "playerctl.pause":
|
if widget.name == "playerctl.pause":
|
||||||
|
|
Loading…
Reference in a new issue