Skip to content

fix(spotify): follow spicetify docs, remove incompatible installs, improve maintainability - #153

Open
yukazakiri wants to merge 2 commits into
snowarch:mainfrom
yukazakiri:fix/spotify-setup
Open

fix(spotify): follow spicetify docs, remove incompatible installs, improve maintainability#153
yukazakiri wants to merge 2 commits into
snowarch:mainfrom
yukazakiri:fix/spotify-setup

Conversation

@yukazakiri

Copy link
Copy Markdown
Contributor

Summary

Refactors the Spotify setup script to follow the official Spicetify documentation, remove incompatible installations, and improve maintainability.

Problem

The existing /setup-spotify script had several issues:

  • Did not remove incompatible Spotify installs (Flatpak, Snap, spotify-launcher) before attempting AUR installation
  • Could fail with cryptic errors due to package conflicts (e.g., spicetify-cli vs spicetify-cli-git)
  • Mixed concerns in a single monolithic block, making it hard to maintain
  • Terminal would close on errors, hiding the actual failure message

Changes

Bug Fixes

  • Remove incompatible installs before installing AUR packages:
    • Flatpak com.spotify.Client
    • Snap spotify
    • spotify-launcher (AUR)
    • Conflicting spicetify-cli-git package
  • Follow Spicetify docs for Linux setup:
    • Proper sudo chmod a+wr /opt/spotify permissions
    • Separate first-run phase (launch Spotify → generate prefs → close → apply backup)
    • Official recovery flow: backup applyrestore backup apply → clear stale state → retry
  • Hold terminal on error: _lib.sh ERR trap now calls setup_finish_pause so the terminal stays open

Refactoring

  • Split monolithic script into logical phase functions:
    • _remove_incompatible() — clean up conflicting installs
    • _install_packages() — AUR install + PATH verification
    • _configure_spicetify() — set paths and permissions
    • _generate_prefs() — first-run Spotify launch
    • _apply_spicetify() — backup apply with recovery
    • _install_marketplace() + _apply_theme() — extras
  • Added _die() helper for consistent fatal errors
  • Added TRACE=1 support for bash set -x debugging
  • Added developer notes in header comments

Testing

  • Verified on Arch Linux with paru AUR helper
  • Script handles existing spicetify-cli-git conflict gracefully
  • Terminal stays open on errors
  • Non-Arch path (Flatpak) unchanged

Related

- check spicetify is in PATH after install

- create spicetify config dir before running commands

- fix chmod -R flag placement

- guard spicetify -c failure and config file existence

- wait for existing Spotify process to close before patching

- pause after closing Spotify to release file locks

- fail explicitly if backup apply still fails after prefs generation

- wrap sudo chmod in error-tolerant checks so script continues if sudo fails
…ility

- split monolithic script into logical phase functions

- add _die() helper for consistent error handling with terminal hold

- remove removed-variable tracking and unnecessary checks

- add TRACE=1 debug support

- consolidate theme script path into a single variable

- add developer notes in header comments

- use heredoc for banner text for cleaner formatting
@snowarch snowarch moved this from Todo to In Progress in iNiR thing May 23, 2026
@snowarch snowarch self-assigned this May 23, 2026
@snowarch

Copy link
Copy Markdown
Owner

Thanks @yukazakiri — the phased refactor is solid and follows the spicetify docs. Queued for an integration test on a clean Arch box first, since it removes flatpak/snap/launcher installs and I want to verify the recovery flow before merging. Will follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants