dietervanhoof / polybar-spotify-controls

MIT License
87 stars 8 forks source link

playpause not showing #17

Open soderluk opened 3 years ago

soderluk commented 3 years ago

WM: i3 version 4.19 OS: Ubuntu 20.04 Polybar: polybar 3.4.3 dbus: 1.2.16 Python: 3.8.6 polybar-spotify-controls: latest master

I've got ipc enabled for my bar, and used the setup from the README to add the spotify modules to my bar center modules-center = spotify previous playpause next. Adjusted just the script paths and interval for the nex/previous buttons.

image

The only thing showing is the next/previous buttons, as seen in the screenshot above. If I move the hook-1 script to hook-0 in the module/spotify it shows the playing song.

In module/playpause it doesn't toggle anything if I move e.g. the Play button to hook-0.

Here's the polybar config:

...
[module/previous]
type = custom/script
interval = 300
format = "%{T3}<label>"
format-padding = 2
; Previous song icon
exec = echo ""
; Check if spotify is running before displaying the icon
exec-if = "pgrep spotify -x"
format-underline = ${colors.nord14}
; #1db954
line-size = 1
click-left = "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"

[module/next]
type = custom/script
interval = 300
format = "%{T3}<label>"
format-padding = 2
; Next song icon
exec = echo ""
; Check if spotify is running before displaying the icon
exec-if = "pgrep spotify -x"
format-underline = ${colors.nord14}
line-size = 1
click-left = "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next"

[module/playpause]
type = custom/ipc
; Default
hook-0 = echo ""
; Playing
hook-1 = echo ""
; Paused
hook-2 = echo ""
initial = 1
format-underline = ${colors.nord14}
format-padding = 2
line-size = 1
click-left = "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"

[module/spotify]
type = custom/ipc
hook-0 = echo ""
hook-1 = python3 ~/.config/polybar/scripts/spotify/spotify_status.py
initial = 1
format-padding = 2
format-underline = ${colors.nord14}
line-size = 1
click-left = i3-msg '[class="Spotify"] focus'
...
S33G commented 2 years ago

I have the same thing here.

S33G commented 2 years ago

So I figured out that pressing pause in spotify fixes this