diff --git a/.config/polybar/config b/.config/polybar/config index 13ebdf8..85af622 100755 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -53,7 +53,7 @@ font-2 = siji:pixelsize=10;1 modules-left = i3 modules-center = -modules-right = mpd pulseaudio memory cpu wlan eth battery date +modules-right = spotifyd pulseaudio memory cpu wlan eth battery date tray-position = right tray-padding = 2 @@ -404,6 +404,13 @@ menu-2-0-exec = sudo poweroff menu-2-1 = cancel menu-2-1-exec = menu-open-0 +[module/spotifyd] +type = custom/ipc + +hook-0 = $HOME/.config/polybar/spotifyd-meta.sh + +initial = 1 + [settings] screenchange-reload = true ;compositing-background = xor diff --git a/.config/spotifyd/change.sh b/.config/spotifyd/change.sh index fc06670..3e2ed7e 100755 --- a/.config/spotifyd/change.sh +++ b/.config/spotifyd/change.sh @@ -1,3 +1,18 @@ #!/usr/bin/env sh -notify-send "$(playerctl -f "{{title}} - {{artist}}" metadata)" +# send ipc to polybar to update + +hook (){ + polybar-msg hook spotifyd 1 +} + +i=0 + +until hook || [ $i -gt 10 ]; +do + sleep 1 + let i=i+1 +done + +exit $? +