#!/usr/bin/bash # This script is skipped if no spicetify-cli is available or no spotify is installed if ! command -v spicetify > /dev/null; then echo "Skipping Spotify Theming, no spicetify-cli available" exit 0 fi if [ ! -d "/opt/spotify" ]; then echo "Skipping Spotify Theming, no spotify found at /opt/spotify" exit 0 fi # Apply theme to spotify if either the spotify binary has changed, or the theme was updated in github {{ $spotifyPath := "/opt/spotify/spotify" }} {{ $s := stat $spotifyPath }} {{ if and $s (hasKey $s "Exists") $s.Exists }} # spotify hash: {{ include $spotifyPath | sha256sum }} {{ else }} # spotify hash: {{ end }} {{ $catppuccinPath := joinPath .chezmoi.homeDir ".config/spicetify-catppuccin-theme/catppuccin/app.scss" }} {{ $c := stat $catppuccinPath }} {{ if and $c (hasKey $c "Exists") $c.Exists }} # catppuccin hash: {{ include $catppuccinPath | sha256sum }} {{ else }} # catppuccin hash: {{ end }} mkdir -p ~/.config/spicetify/Themes cp -r ~/.config/spicetify-catppuccin-theme/catppuccin ~/.config/spicetify/Themes/ getent group spotify > /dev/null || { echo "System group spotify is missing" echo "Please create it with groupadd -r spotify" echo "Then re-login and try again" exit 1 } sudo chgrp spotify /opt/spotify sudo chgrp -R spotify /opt/spotify/Apps sudo chmod 775 /opt/spotify sudo chmod 775 -R /opt/spotify/Apps spicetify backup spicetify config current_theme catppuccin spicetify config color_scheme mocha spicetify config inject_css 1 inject_theme_js 1 replace_colors 1 overwrite_assets 1 spicetify apply