Merge pull request #957 from LokiLuciferase/fix/playerctl-calls

remove unnecessary `playerctl` subprocess call to determine whether widget should be hidden
This commit is contained in:
tobi-wan-kenobi 2023-03-15 20:03:14 +01:00 committed by GitHub
commit ad8b1802f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

7
bumblebee_status/modules/contrib/playerctl.py Executable file → Normal file
View 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":