rayzr522 / now-clocking

a conky widget that shows now playing information when music is playing or a clock when music is not playing
49 stars 14 forks source link

Bug fix: script thinks player is still open after it closed #3

Closed jgabriel98 closed 3 years ago

jgabriel98 commented 3 years ago

The script used this command to detect if the spotify player was running:

${if_running spotify} ...stuff here...

What this command really do: it looks for a process that matches the given name (in this case, 'spotify').

But the problem is: some players have multiple process, and some of those always keep running, as a background task (i guess). And that is the case with spotify.

So, this lead us to the bug: after closing the player, one process remain running. So the script thinks the player is running (but it's not). nowClocking_bug

Solution

changed ${if_running spotify} to ${if_match "" != "${exec playerctl -p spotify status}}, so now it will really check for the player status, not for the player process.

rayzr522 commented 3 years ago

@jgabriel98 can you give steps to reproduce this? i've never had this issue with spotify, and if the player is still open in the background then your check should still theoretically suffer from the same issue (as playerctl -p spotify status should still return Paused/Stopped, neither of which are an empty string as the script checks for)

rayzr522 commented 3 years ago

closing for now, feel free to reopen if you still experience this issue and can provide consistent reproductive steps / environment