Spotify ad‑blocking patcher for Linux focused on blocking audio, video, and banner ads (plus premium prompts) in the Flatpak client.
SPOTLESS installs a small CLI (spotless) that patches Spotify’s xpui.spa bundle, creates a backup, and can restore the original files.
spotless --statusExample output (abridged):
Spotify Status:
Installed: True
Type: flatpak
Path: /var/lib/flatpak/app/com.spotify.Client/current/active/files/extra/share/spotify
Version: Unknown
Patched: False
Backup exists: True
- Blocks audio/video ad logic and banner placements
- Hides the top‑bar “Explore Premium” button
- Disables telemetry (Sentry)
- Safe backup + restore
- Dry‑run and status modes
spotless/
├── src/
│ └── patcher.py # Main CLI patcher (installed as `spotless`)
├── scripts/
│ ├── install.sh # Installs CLI and applies patches
│ └── uninstall.sh # Restores and removes installed files
└── LICENSE
- Python 3.8+
- Flatpak
- Spotify Flatpak (
com.spotify.Client) sudo(needed for system Flatpak installs under/var/lib/flatpak)
Ubuntu/Debian:
sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.spotify.ClientFedora:
sudo dnf install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.spotify.Clientgit clone https://github.com/Nikish-codes/spotless.git
cd spotless
./scripts/install.shIf spotless isn’t found:
export PATH="$HOME/.local/bin:$PATH"
hash -rflatpak run com.spotify.ClientApply patches:
spotlessShow status:
spotless --statusDry‑run (no changes):
spotless --dry-run --verboseRestore from backup:
spotless --restoreAdvanced flags:
spotless --path /var/lib/flatpak/app/com.spotify.Client/current/active/files/extra/share/spotify
spotless --config /path/to/config.json
spotless --verbosespotless accepts an optional JSON config file via --config. Only custom_patches is currently used.
Example config.json:
{
"custom_patches": [
{
"name": "example_patch",
"file": "*.js",
"signature": "original_string",
"replacement": "new_string",
"is_regex": false
}
]
}- Detects the Flatpak Spotify path (system or user)
- Creates
xpui.spa.bakif it does not already exist - Extracts
xpui.spa(a ZIP archive) to a temp directory - Applies built‑in string and regex patches to JS/CSS assets
- Rebuilds and replaces the patched
xpui.spa
If the install path is not writable, the patcher escalates using sudo for file copy and permission changes.
./scripts/uninstall.shThis restores the original Spotify files (if a backup exists) and removes:
~/.local/share/spotless~/.local/bin/spotless
There is no automated test suite yet. For a quick validation:
spotless --dry-run --verbose
spotless --statusspotless: command not found
- Add
~/.local/binto PATH (see install section).
- "Unsupported Spotify installation detected"
- Remove Snap/native Spotify packages and keep only Flatpak.
- "Flatpak Spotify not found"
- Install
com.spotify.Clientfrom Flathub.
- "Need elevated privileges"
- System Flatpak installs live under
/var/lib/flatpak.
- "0 patches applied"
- Spotify may have changed signatures. Update
src/patcher.pyand re‑run.
- "xpui.spa not found"
- Reinstall the Flatpak client or run
flatpak repair --user.
Contributions are welcome. Keep changes focused and easy to review.
- Fork the repo and create a feature branch
- Make minimal, clear changes
- Run
spotless --dry-run --verboseto sanity‑check - Open a PR with a short summary and any relevant logs
GPL-3.0-only. See LICENSE.