dietervanhoof / polybar-spotify-controls

MIT License
87 stars 8 forks source link

Previous and Next modules are still displayed when spotify is closed #8

Closed Esya closed 5 years ago

Esya commented 5 years ago

Is there a way to avoid this?

2019-05-31-021325_343x67_scrot

Esya commented 5 years ago

For now I'm doing something dirty :

[module/next]
type = custom/script
interval = 10
format = "%{T3}<label>"
format-padding = 5
; Next song icon
exec = pidof spotify >/dev/null && echo ""
format-underline = #1db954
line-size = 1
click-left = "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next"

Changed the interval to 10, added a pidof spotify before the echo, it solves it

dietervanhoof commented 5 years ago

Good point! Do you think we can do it this way? I feel like this is a pretty clean solution. I'd love to have your opinion on it.

dietervanhoof commented 5 years ago

I just tried it out and it seems to work fine for me. I've updated my readme file to reflect the changes in the above pull request. Try it out!

dietervanhoof commented 5 years ago

You can always reopen this issue or create a new one if there's still a problem.

Esya commented 5 years ago

You're right, it's definitely cleaner than my solution, didn't even know about exec-if - What would be great is to also find a way to hide the title and play button after spotify has been launched and stopped - not sure how to do this without adding something to the python script that watches the dbus though... Let me know if you have any thoughts. Thanks!