Skip to content

Commit

Permalink
mpris: hide all non can_play players
Browse files Browse the repository at this point in the history
  • Loading branch information
valdur55 committed Oct 24, 2024
1 parent 687c88d commit b619bfa
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions py3status/modules/mpris.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
icon_previous: specify icon for previous button (default u'\u25c3')
icon_stop: specify icon for stop button (default u'\u25a1')
max_width: maximum status length (default None)
player_hide_non_canplay: For hiding players which doesn't close mpris interface after media closing
(for example chromium based browsers)
(default [])
player_priority: priority of the players.
Keep in mind that the state has a higher priority than
player_priority. So when player_priority is "[mpd, bomi]" and mpd is
Expand Down Expand Up @@ -152,7 +149,6 @@ def __init__(
self._player_shortname = name_from_id
self._dPlayer = dPlayer(dbus_interface_info={"dbus_uri": player_id})
self._full_name = f"{self._identity} {self._identity_index}"
self._hide_non_canplay = self._player_shortname in self.parent.player_hide_non_canplay

self._placeholders = {
"player": self._identity,
Expand Down Expand Up @@ -348,7 +344,7 @@ def data(self):

@property
def hide(self):
return self._hide_non_canplay and not self._can.get("CanPlay")
return not self._can.get("CanPlay")

@property
def id(self):
Expand Down Expand Up @@ -382,12 +378,21 @@ class Py3status:
icon_previous = "\u25c3"
icon_stop = "\u25a1"
max_width = None
player_hide_non_canplay = []
player_priority = []
state_pause = "\u25eb"
state_play = "\u25b7"
state_stop = "\u25a1"

class Meta:
deprecated = {
'remove': [
{
'param': 'player_hide_non_canplay',
'msg': 'obsolete because we now hide all non canplay players',
},
],
}

def post_config_hook(self):
self._name_owner_change_match = None
self._kill = False
Expand Down Expand Up @@ -485,7 +490,7 @@ def post_config_hook(self):
self._format_contains_control_buttons = True
self._used_can_properties.append(value["clickable"])

if len(self.player_hide_non_canplay) and "CanPlay" not in self._used_can_properties:
if "CanPlay" not in self._used_can_properties:
self._used_can_properties.append("CanPlay")

self._format_contains_time = self.py3.format_contains(self.format, "time")
Expand Down

0 comments on commit b619bfa

Please sign in to comment.