Last active
April 26, 2018 22:06
-
-
Save lhw/fc3424846cb67828ee0ca1e514ce0561 to your computer and use it in GitHub Desktop.
Spotify docker container with local cache and dbus mpris integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [[ -n "$(docker ps -qaf 'name=spotify')" ]]; then | |
docker restart spotify | |
else | |
USER_UID=$(id -u) | |
USER_GID=$(id -g) | |
xhost "si:localuser:${USER}" | |
docker run --rm \ | |
-e "USER_UID=${USER_UID}" \ | |
-e "USER_GID=${USER_GID}" \ | |
-e "DISPLAY=unix${DISPLAY}" \ | |
-e "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus" \ | |
-v "/tmp/.X11-unix:/tmp/.X11-unix:ro" \ | |
-v "/run/user/${USER_UID}/pulse:/run/pulse:ro" \ | |
-v "/run/user/${USER_UID}/bus:/run/dbus" \ | |
-v "${HOME}/.config/spotify:/data/config" \ | |
-v "${HOME}/.cache/spotify:/data/cache" \ | |
--name spotify \ | |
mib4fun/spotify-desktop | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment