Skip to content

Commit d75ffb7

Browse files
committed
playerctl module: hide non-can-play players and use chrome and chromium as default value.
1 parent 49d51e3 commit d75ffb7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

py3status/modules/playerctl.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*(default '[\?color=status [\?if=status=Playing > ][\?if=status=Paused \|\| ]'
2525
'[\?if=status=Stopped .. ][[{artist}][\?soft - ][{title}|{player}]]]')*
2626
format_player_separator: show separator if more than one player (default ' ')
27+
player_hide_non_canplay: For hiding players which doesn't close mpris interface after media closing
28+
(default ['chromium', 'chrome'])
2729
players: list of players to track. An empty list tracks all players (default [])
2830
seek_delta: time (in seconds) to change the playback's position by (default 5)
2931
thresholds: specify color thresholds to use for different placeholders
@@ -98,6 +100,7 @@ class Py3status:
98100
r"[\?if=status=Stopped .. ][[{artist}][\?soft - ][{title}|{player}]]]"
99101
)
100102
format_player_separator = " "
103+
player_hide_non_canplay = ["chromium", "chrome"]
101104
players = []
102105
seek_delta = 5
103106
thresholds = {"status": [("Playing", "good"), ("Paused", "degraded"), ("Stopped", "bad")]}
@@ -273,6 +276,12 @@ def playerctl(self):
273276
players = []
274277
cached_until = self.py3.CACHE_FOREVER
275278
for player in tracked_players:
279+
if (
280+
not player.props.can_play
281+
and player.props.player_name in self.player_hide_non_canplay
282+
):
283+
continue
284+
276285
player_data = self._get_player_data(player)
277286

278287
# Check if the player should cause the module to continuously update

0 commit comments

Comments
 (0)