polybar / polybar/polybar-scripts

player-mpris-tail.py does not print icon-none on startup.

Open
#389 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Shell
Stars
2.6k
Forks
331
PR merge metrics
No merged PRs in 30d

Description

The script doesn't display anything when no player is connected initially.
--icon-none will only be displayed after at least one player has connected and disconnected, as the code responsible for it is put in removePlayer().

I currently have this workaround to make it work:

--- /usr/share/polybar/scripts/player-mpris-tail.py	2022-09-16 13:04:47.000000000 +0800
+++ player-mpris-tail.py	2022-09-17 19:48:07.365836908 +0800
@@ -30,6 +30,8 @@
         self.connected = False
         self.player_states = {}
 
+        _printFlush(ICON_NONE)
+
         self.refreshPlayerList()
 
         if self._connect:

If this is the correct way, I can PR it.
If it's wrong and there's already some magical polybar way to do it, please point me to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with player-mpris-tail.py, especially the initialization path, refreshPlayerList(), and removePlayer(). Reproduce the case where no player is connected at startup and confirm that --icon-none is not printed. The workaround shows the expected behavior: print ICON_NONE during startup, then verify it still updates correctly when players connect or disconnect.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.