This takes the currently playing track and displays it in polybar.
In /etc/pulse/default.pa you'll want to allow anonymous on local unix sockets
load-module module-native-protocol-unix auth-anonymous=1
Alias mopidy and ncmpcpp in your ~/.bashrc or ~/.bash_aliases.
# Mopidy music server
alias mopidy='docker run -d --rm --name mopidy \
-v /run/user/$UID/pulse/native:/tmp/pulse/native \
-e "PULSE_SERVER=unix:/tmp/pulse/native" \
-p 6600:6600/tcp -p 6680:6680/tcp -p 5555:5555/udp \
sammerry/mopidy mopidy\
-o spotify/username=[redacted] -o spotify/password=[redacted] \
-o spotify/client_id=[redacted] \
-o spotify/client_secret=[redacted]
# Ncmpcpp music client
alias ncmpcpp='docker run --rm -it \
-v $HOME/.config/ncmpcpp:/home/ncmpcpp/.ncmpcpp --name ncmpcpp \
--net container:mopidy sammerry/ncmpcpp ncmpcpp'
check that you can play music through mopidy and hear sound. This may need some tweaking for your system. Mopidy needs a little time to pull down your spotify, pandora, youtube... etc playlists so give it a moment.
mopidy
sleep 10
ncmpcppIf you can see playlists in ncmpcpp and hear music through mopidy. You should be good to go. Place mopidy.sh in ~/.config/polybar/scripts/ and add the text in config to ~/.config/polybar/config then run chmod +x mopidy.sh
once you start streaming music you should see the track in polybar.