spotify-adblock
spotify-adblock copied to clipboard
Spotify flatpak fix
The actual spotify binary is in a different folder, so people may need to run spotify flatpak with something like this:
flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/user/.spotify-adblock/spotify-adblock.so" com.spotify.Client
--env="LD_PRELOAD=/path/to/adblock.so" might work also?
This doesn't load the adblocker since you set the command directly to the spotify binary. --command
has to be set to sh
in order for the -c '...'
in the end to be executed.
And if set correctly it still can't start.
For me the fix was to download the prebuilt binary instead of building it myself.
Yeah, maybe I got it wrong.
flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/user/.spotify-adblock/spotify-adblock.so" com.spotify.Client
seems to work, but I built the library in an Ubuntu distrobox container.
I don't use Flatpak, so I can't test this. Can someone confirm that the path has changed, the current instructions in the README are broken and
flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/user/.spotify-adblock/spotify-adblock.so" com.spotify.Client
definitely works without breaking anything else (e.g. by overriding LD_PRELOAD
like that)?
@abba23 Hey I did test it out on 2 of my Fedora computers running flatpak and it runs fine but doesnt block ads
same here on archlinux
commandline: flatpak run --command=/app/extra/share/spotify/spotify --file-forwarding --env="LD_PRELOAD=/home/alsog/.spotify-adblock/spotify-adblock.so" com.spotify.Client --no-sandbox --no-zygote
ERROR: ld.so: object '/home/alsog/.spotify-adblock/spotify-adblock.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
You need to whitelist ~/.spotify-adblock with flatseal
@pizzadude thanks! seems to be working fine now
@pizzadude that was it :) thanks!
I'm only managing to start from the command line (flatpak run --command=sh com.spotify.Client -c 'eval "$(sed s#LD_PRELOAD=#LD_PRELOAD=$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)"'
) and not from the GNOME integrated .desktop file.
As Spotify is installed as a system-wide flatpak, I've tried patching both /var/lib/flatpak/app/com.spotify.Client/x86_64/stable/active/export/share/applications/com.spotify.Client.desktop
and /var/lib/flatpak/app/com.spotify.Client/x86_64/stable/active/files/share/applications/com.spotify.Client.desktop
but no luck.
So which even is the right .desktop file to patch? And are the instructions on the README still valid?
Regarding this:
You need to whitelist ~/.spotify-adblock with flatseal
you can also use the commands mentioned in the README if you don't want to bother with Flatseal (which is a great app, in any case):
flatpak override --user --filesystem="~/.spotify-adblock/spotify-adblock.so" --filesystem="~/.config/spotify-adblock/config.toml" com.spotify.Client
They do the same thing.
You need to whitelist ~/.spotify-adblock with flatseal
Hey can you go into further details as to how to do this? This is what i see with flatseal
I'm not sure how to whitelist a specific path, if thats possible.
It would look like this in Flatseal:
then enter the path:
Done.
Otherwise open a terminal and run:
flatpak override --user --filesystem="~/.spotify-adblock/spotify-adblock.so" --filesystem="~/.config/spotify-adblock/config.toml" com.spotify.Client
which does the same thing, it allows the flatpak to access the two files in ~/.config/spotify-adblock.
In the above screenshots you can see that those two files are already visible in Flatseal, because i ran that command.
It would look like this in Flatseal: ?
One year after you asked, on a fresh Arch install, this command is working for me while the one in the readme gave "command not found". Unlike the other poster, I am not seeing ads.
Don't know what happened, but I had to change it to
flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/$USER/.spotify-adblock/spotify-adblock.so" com.spotify.Client
to get it working again. Haven't used it in a couple weeks so I can't say when the issue first occurred. Other than a couple system updates (pacman -Syu), I haven't changed anything. I guess I did install STEAM flatpak which is currently running if that matters.
I was getting the same error as @alsoGAMER and also running Arch.