Skip to content

Instantly share code, notes, and snippets.

@p0358
Last active December 18, 2025 20:05
Show Gist options
  • Select an option

  • Save p0358/841be7aadf72ca3084ebadd840cfe690 to your computer and use it in GitHub Desktop.

Select an option

Save p0358/841be7aadf72ca3084ebadd840cfe690 to your computer and use it in GitHub Desktop.
SpotX Pacman Hook (spotx-git + spotify)

SpotX Pacman Hook

For example put it into: /etc/pacman.d/hooks/spotx.hook

Tested with spotx-git + spotify AUR packages.

This hook will re-run spotx after every Spotify or SpotX update (both of which warrant it, as Spotify will override the files to stock, and updated SpotX might fix bugs or add support for new Spotify versions).

The -f flag has to be used, since otherwise the script will exit with an error after SpotX was updated, but Spotify was not, the error informing you that the patch was already performed. The -f flag will cause the SpotX script to firstly restore the backup that it has previously made, and only then apply the patch, ensuring that the patches apply cleanly on the current version once again.

Target = spotx-git is needed, since the spotx-git package providing spotx is not enough to trigger the hook (it's not considered a target). The Depends = spotx on the other hand is fine.

Note that a hook like this only makes sense if both SpotX and Spotify are installed by pacman. If you're using the spotify-launcher package or another means of installation such as Flatpak, the hook will not trigger when those upgrade and override the Spotify binaries. Quite obviously.

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = spotify
Target = spotify-dev
Target = spotify-edge
Target = spotx
Target = spotx-git
[Action]
Description = Running SpotX after Spotify/SpotX upgrade.
When = PostTransaction
Exec = /usr/bin/spotx -f
Depends = spotx
Depends = spotify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment