Skip to content

Commit

Permalink
playerctl module: hide non-can-play players and use chrome and chromi…
Browse files Browse the repository at this point in the history
…um as default value.
  • Loading branch information
valdur55 committed Aug 27, 2024
1 parent 49d51e3 commit d75ffb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions py3status/modules/playerctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*(default '[\?color=status [\?if=status=Playing > ][\?if=status=Paused \|\| ]'
'[\?if=status=Stopped .. ][[{artist}][\?soft - ][{title}|{player}]]]')*
format_player_separator: show separator if more than one player (default ' ')
player_hide_non_canplay: For hiding players which doesn't close mpris interface after media closing
(default ['chromium', 'chrome'])
players: list of players to track. An empty list tracks all players (default [])
seek_delta: time (in seconds) to change the playback's position by (default 5)
thresholds: specify color thresholds to use for different placeholders
Expand Down Expand Up @@ -98,6 +100,7 @@ class Py3status:
r"[\?if=status=Stopped .. ][[{artist}][\?soft - ][{title}|{player}]]]"
)
format_player_separator = " "
player_hide_non_canplay = ["chromium", "chrome"]
players = []
seek_delta = 5
thresholds = {"status": [("Playing", "good"), ("Paused", "degraded"), ("Stopped", "bad")]}
Expand Down Expand Up @@ -273,6 +276,12 @@ def playerctl(self):
players = []
cached_until = self.py3.CACHE_FOREVER
for player in tracked_players:
if (
not player.props.can_play
and player.props.player_name in self.player_hide_non_canplay
):
continue

player_data = self._get_player_data(player)

# Check if the player should cause the module to continuously update
Expand Down

0 comments on commit d75ffb7

Please sign in to comment.