Skip to content

Instantly share code, notes, and snippets.

@themagicalmammal
Last active February 18, 2023 09:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themagicalmammal/f6f086f9c701924371e1d334c60c8562 to your computer and use it in GitHub Desktop.
Save themagicalmammal/f6f086f9c701924371e1d334c60c8562 to your computer and use it in GitHub Desktop.
Spicetify Installation Script
#!/bin/sh
# Install spicetify-cli
install_spicetify () {
curl -fsSL https://raw.githubusercontent.com/khanhas/spicetify-cli/master/install.sh | sh
export SPICETIFY_INSTALL="$HOME/spicetify-cli"
export PATH="$SPICETIFY_INSTALL:$PATH"
echo 'export SPICETIFY_INSTALL="$HOME/spicetify-cli"' >> ~/.profile
echo 'export PATH="$SPICETIFY_INSTALL:$PATH"' >> ~/.profile
echo "Program installed, Configuring...."
}
# Apply the theme
apply_theme () {
echo "Successfully installed, now applying theme"
spicetify backup apply enable-devtool
spicetify update
echo "Everything is done, enjoy your themed Spotify"
}
# Check if curl is installed
if ! command -v curl > /dev/null; then
echo "curl is required to run this script. Please install curl and try again."
exit 1
fi
# Check if Spotify is installed
if ! command -v spotify > /dev/null; then
echo "Spotify is not installed. Please install Spotify and try again."
exit 1
fi
# Install spicetify-cli and apply theme for Linux distributions
if [ "$(uname -s)" = "Linux" ]; then
if [ -f /usr/share/spotify/spotify ]; then
echo "The script will now be applied for the version installed with your package manager"
install_spicetify
sudo chmod a+wr /usr/share/spotify
sudo chmod a+wr /usr/share/spotify/Apps -R
apply_theme
elif [ -f $(flatpak --installations)/app/com.spotify.Client/x86_64/stable/active/files/extra/share/spotify/spotify ]; then
echo "The script will now be applied for the flatpak version"
install_spicetify
if [ -f ~/.var/app/com.spotify.Client/config/spotify/prefs ]; then
sed -i "s/prefs_path.*/prefs_path = \/home\/$USER\/.var\/app\/com.spotify.Client\/config\/spotify\/prefs/g" $HOME/.config/spicetify/config.ini
else
sed -i "s/prefs_path.*/prefs_path = \/home/$USER\/.config\/spotify\/prefs/g" $HOME/.config/spicetify/config.ini
fi
sudo chmod a+wr /var/lib/flatpak/app/com.spotify.Client/x86_64/stable/active/files/extra/share/spotify
sudo chmod a+wr -R /var/lib/flatpak/app/com.spotify.Client/x86_64/stable/active/files/extra/share/spotify/Apps
apply_theme
elif [ -f /snap/spotify ]; then
echo "snap isn't supported by spicetify, consider installing the flatpak or from the repositories"
else
echo "Spotify doesn't seem to be installed. This may be a flatpak issue which causes path conflict. Please install using specified channels. If you have done say please raise a issue on github."
fi
# Install spicetify-cli and apply theme for macOS
elif [ "$(uname -s)" = "Darwin" ]; then
install_spicetify
apply_theme
# Unsupported operating system
else
echo "Unsupported operating system"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment