Spotify Arch

Posted onby admin

How to Mute Spotify Ads on Arch Linux? In this tutorial we will see how to block Spotify ads on Arch Linux using Spotify-AdKiller. Extension for playing music from the Spotify music streaming service.

Package Details: spotify-legacy 0.9.17-3

Package Actions

Spotify Archewell

  • View PKGBUILD / View Changes
Git Clone URL: https://aur.archlinux.org/spotify-legacy.git (read-only, click to copy)
Package Base: spotify-legacy
Description: A proprietary music streaming service.
Upstream URL: https://www.spotify.com/download/linux/
Licenses: custom
Conflicts: spotify, spotify-beta, spotify-stable, spotify094
Provides: spotify=0.9.17
Submitter: olejon
Maintainer: olejon
Last Packager: olejon
Votes: 33
Popularity: 0.000000
First Submitted: 2016-04-30 17:14
Last Updated: 2017-06-09 10:36
Spotify Arch

Dependencies (17)

  • alsa-lib(alsa-lib-x205ta, alsa-lib-git, alsa-lib-minimal-git, alsa-lib-a52pcm)
  • desktop-file-utils(desktop-file-utils-git)
  • gconf(gconf-gtk2)
  • glib2(glib2-sched-policy, glib2-clear, glib2-quiet, glib2-selinux, glib2-nodocs-git, glib2-git, glib2-patched-thumbnailer)
  • gtk2(gtk2-patched-gdkwin-nullcheck, gtk2-ubuntu, gtk2-git, gtk2-minimal-git, gtk2-patched-filechooser-icon-view)
  • libcurl-compat(libcurl-compat-minimal-git)
  • libgcrypt15(libgcrypt15-git, libgcrypt15-minimal-git)
  • libsystemd (systemd-light-libs, systemd-cdown-libs-git, systemd-libs-git, systemd-libs-selinux, systemd-libs)
  • libx11(libx11-git)
  • nss(nss-hg)
  • openssl-1.0(openssl-1.0-chacha20, openssl-1.0-hardened)
  • qt4(qt4-revert80e3108)
  • rtmpdump(rtmpdump-ksv-git, rtmpdump-git)
  • zenity(qarma-git, zenity-gtk2, zenity-git, zenity-light)

Required by (20)

  • blockify(requires spotify)
  • blockify-git(requires spotify)
  • genius-spicetify-git(requires spotify)
  • i3blocks-contrib(requires spotify)(optional)
  • i3blocks-contrib-git(requires spotify)(optional)
  • i3blocks-contrib-install-git(requires spotify)(optional)
  • musixmatch-bin(requires spotify)(optional)
  • mustream-git(requires spotify)
  • polybar-spotify(requires spotify)
  • polybar-spotify-module(requires spotify)
  • sp(requires spotify)
  • spotify-adblock(requires spotify)
  • spotify-adblock-git(requires spotify)
  • spotify-adkiller-dns-block-git(requires spotify)
  • spotify-adkiller-git(requires spotify)
  • spotify-tray-git(requires spotify)
  • spotifywm-git(requires spotify)(optional)
  • spotrec(requires spotify)(optional)
  • spotrec-git(requires spotify)(optional)

olejon commented on 2019-03-09 17:37

It is a problem with the ffmpeg0.10 package. The solution is posted below and in that package's comments, and x264 (video decoding) is not needed for local files playback - you have the regular ffmpeg package alongside this installed for that - so no problem not compiling it in.

  • Here is the updated working guide:
  • Hope it works for you

olejon commented on 2019-03-09 17:37

It is a problem with the ffmpeg0.10 package. The solution is posted below and in that package's comments, and x264 (video decoding) is not needed for local files playback - you have the regular ffmpeg package alongside this installed for that - so no problem not compiling it in.

  • Here is the updated working guide:
  • Hope it works for you

andmars commented on 2019-03-08 04:33

doesn't build:

'libavcodec/libx264.c: In Funktion »X264_init_static«:libavcodec/libx264.c:595:9: Fehler: »x264_bit_depth« nicht deklariert (erstmalige Verwendung in dieser Funktion); meinten Sie »x264_picture_t«? if (x264_bit_depth 8) ^~~~~~~~~~~~~~ x264_picture_tmake: *** [common.mak:45: libavcodec/libx264.o] Fehler 1> FEHLER: Ein Fehler geschah in build(). Breche ab...'

olejon commented on 2017-06-09 11:32

I have updated this package now with the dependencies needed to run. It runs fine here, but have not tested during time.

Rapti commented on 2017-05-14 20:28

The latest version of qt4 causes Spotify to crash from a segmentation fault a few seconds after startup on my machine. This can be temporarily fixed by downgrading qt4 to a previous version.

l444 commented on 2017-05-13 15:37

NIIICE, hate the new version. WIll keep this till it stops working

usuariopolivalen commented on 2017-04-25 07:31

there is a workaround for getting spotify to launch, see spotify aur page for more information if you want to get spotigy work or if you want to include in spotify legacy aur page

usuariopolivalen commented on 2017-04-24 17:14

since the last update of openssl and other spotify is imposible to launch...

Scimmia commented on 2016-08-25 15:38

You will need to uninstall 0.9.17-1 before updating to 0.9.17-2. Sorry, the old package put untracked files all over the place, nothing else we can do.
If you still get conflicting file errors, please see https://wiki.archlinux.org/index.php/Pacman#.22Failed_to_commit_transaction_.28conflicting_files.29.22_error
It's very possible even uninstalling doesn't completely clean up the mess.

Scimmia commented on 2016-08-22 15:03

Scimmia commented on 2016-08-20 06:59

This doesn't actually create a package? It really, really needs fixed.

Spotify is a digital music streaming service with a freemium business model. This article is mainly about the semi-official, proprietary Spotify for Linux client, which is developed by Spotify's engineers in their spare time and not actively supported by Spotify.[1] Alternatively, there is an online player and a number of open source third-party clients.

Installation

Spotify for Linux can be installed with the spotifyAUR package. If you wish to play local files you will need to additionally install zenity and ffmpeg-compat-57AUR.

Third-party clients

  • Clementine — Able to stream from Spotify with a premium account after activating (downloading) a plugin in the settings.
https://www.clementine-player.org/ clementine
  • Librespot — An open source client library for Spotify. It enables applications to use Spotify's service (streaming), without using the official closed-source libspotify. Requires Spotify Premium account.
https://github.com/librespot-org/librespot librespot-gitAUR
  • MellowPlayer — A free, open source and cross-platform desktop application that runs web-based music streaming services in its own window and provides integration with your desktop.
https://colinduquesnoy.gitlab.io/MellowPlayer/ mellowplayerAURmellowplayer-gitAUR
  • Mopidy — An alternative plug-in based implementation of Music Player Daemon is able to stream from Spotify with an extension.
https://www.mopidy.com/ mopidy+ mopidy-spotifyAUR
  • ncspot — Cross-platform ncurses Spotify client written in Rust, inspired by ncmpc and the likes.
https://github.com/hrkfdn/ncspot ncspotAURncspot-gitAUR
  • Psst — Fast and multi-platform Spotify client, made in Rust with a native GUI.
https://github.com/jpochyla/psst psst-gitAUR
  • Spot — Gtk/Rust native Spotify client for the Gnome desktop.
https://github.com/xou816/spot spot-clientAUR
  • Spotifyd — An open source Spotify client running as a UNIX daemon. Spotifyd streams music just like the official client, but is more lightweight and supports more platforms. Spotifyd also supports the Spotify Connect protocol which makes it show up as a device that can be controlled from the official clients. Requires Spotify Premium account.
https://github.com/Spotifyd/spotifyd spotifyd
  • spotify-tui — A Spotify client for the terminal written in Rust.
https://github.com/Rigellute/spotify-tui spotify-tuiAUR
  • spotify-qt — Lightweight Spotify client using Qt written in C++.
https://github.com/kraxarn/spotify-qt spotify-qtAUR
  • Tizonia — Command-line cloud music player for Linux with support for Spotify, Google Play Music, YouTube, SoundCloud, Plex servers and Chromecast devices..
https://tizonia.org/docs/spotify/ tizonia-allAUR
  • Tomahawk — A Music Player App written in C++/Qt. No longer actively developed.
Archlinux
https://github.com/tomahawk-player/tomahawk tomahawk-gitAUR

Tips and tricks

Limit storage size

Spotify automatically manage a storage size for caching, however one may want to force the size limit preventing the filesystem from filling up.

Appendstorage.size (measured in MB) to /home/user/.config/spotify/prefs, e.g. a storage size of 3072MB:

Global media hotkeys

Tip: Many desktop environments come with keyboard shortcuts which work with the Spotify client out of the box e.g. under Cinnamon (Preferences -> Keyboard -> Shortcuts -> Sound and Media), several default bindings are set up to control the player, and these can easily be changed by pressing the preferred keys.

For environments in which controlling Spotify via the keyboard does not work automatically, the official Linux client has support for media keys like XF86AudioPlay. We can use for example xbindkeys to catch the global media keypresses, and then forward them to Spotify using one of the methods below. If you use xbindkeys, ensure that Spotify is restarted after installation and key configuration otherwise the key events will not be properly caught.

MPRIS

The Spotify client implements the MPRIS D-Bus interface which allows external control.

pactl (pulseaudio)

As you might have noticed, MPRIS protocol commands do not include volume control. This is broken within spotify itself, which ignores volume change requests. However, there is a possibility to control volume via pulseaudio's input sink:

The sink number for '$current_sink_num' can be found in the output of command:

You can create a script for changing volume and bind it for example to keyboard shortcut via desktop environments configuration or xdotool described in next section. Here are some examples:

Bash:

This script is based on work done by user Mikołak in this post.

Unfortunately this script is not the fastest solution and if you execute it multiple times via keyboard hotkey, it might become laggy.

Faster (like 10 times) Python code (requires at least Python 3.7 to be installed):

You can save it to a .py file. The last line does the actual job, so you can adjust the command to lower the volume or toggle mute.

Disable track notifications

After version 0.9.10, track change notifications were enabled by default. They can be quite intrusive. To disable them, add the following line to ~/.config/spotify/Users/<spotifylogin>-user/prefs

It is also possible to launch spotify with the --ui.track_notifications_enabled=false option.

Show track notifications

This article or section is a candidate for moving to MPRIS#Playerctl.

Notes: Not specific to spotify. (Discuss in Talk:Spotify#)

playerctl provides a library you can use with python-gobject and a notification daemon such as dunst to show the artist and title in a notification when the track changes.

Skip overplayed radio tracks

This article or section is a candidate for moving to MPRIS#Playerctl.

Notes: Not specific to spotify. (Discuss in Talk:Spotify#)

Another use of the playerctl library is to skip tracks that are played too much on radio when you do not necessarily want to downvote these tracks because you may want to hear them again later on that station.

Mute commercials

Warning: Muting commercials is not supported by Spotify and may result in a temporary ban [2]

blockify

With blockify you can mute commercials. It is available in the AUR as blockifyAUR.

To have this start and run in the background every time Spotify starts you will need to automate this yourself:

By placing this script at /usr/local/bin/spotify, it gets preferred to /usr/bin/spotify everytime you start Spotify, so there is nothing else to change and updates will not break it.

spotblock

spotblock (spotblock-gitAUR) is a resource-efficient ad blocker that runs as a systemd daemon.

Spotify-AdKiller

Spotify-AdKiller (spotify-adkiller-gitAUR) is another alternative to block Spotify ads.

Hosts file

You may also add the following lines to your hosts file to block ads in Spotify :

spclient.wg.spotify.com now appears to block radio and daily mixes, as well as recently played songs.

Remote Control

Send commands via SSH

If you set up ssh on the server, you can send controls from a client to a remote Spotify instance with

where yourcommand can be spotifycmd that you installed on the server, or a dbus script for the linux version, as described above.

Grab the Spotify window via SSH

Aside from grabbing the whole desktop with TeamViewer or VNC to remotely control your server, you can also only grab the Spotify Window from the server to your client.

To do that, you need to configure sshd on your server and install x11vnc on both server and client as well as tigervnc on the client. Then you can use these scripts to grab either the complete dektop or only the Spotify window, which essentially gets you GUI client-like behavior as with MPD.

You will need to copy the second script to ~/.bin/vncgetspotify.sh on the server and the first script to any place on your client.

Finally, to grab the spotify window, run on the client:

or, for the whole desktop:

HiDPI Mode

As the current Spotify build is not DPI aware, the amount to scale the interface by can be specified using the terminal command:

where X is the amount to scale the interface by, e.g 2.

This change can be added to the spotify.desktop file in order to apply the scaling when launching from the desktop.

To make sure the file does not get overwritten when the package is updated, copy it to you local applications folder:

Now edit ~/.local/share/applications/spotify.desktop and add the --force-device-scale-factor option:

You might need to relaunch your Desktop Manager, before these override changes will be effective.

Troubleshooting

Desktop Environment alerts (beeps) mutes Spotify

Comment out 'module-role-cork' in pulse audio configuration file.

Open /etc/pulse/default.pa with your text editor and comment out:

Or simply unload it with:

Using search causes the whole interface to blink and then crash

Spotify Archewell

Spotify is using an old version of Chromium Embedded Framework and hits a bug causing it to crash repeatedly when trying to use the search. This can be worked around by using the following command line option:

Blinking images and improper rendering while using Spotify Linux with DWM

Start spotify as a floating window.

You can add this rule to the rules array in your config.h:

This will tell dwm to start spotify as a floating window associated with the tag '2' no matter what window mode you are in. Recompile and install dwm to apply your new settings.

Broken search, browsing or radio

Spotify bug report concerning non-english locales

If various tabs like browsing only show a blank screen, the search field does not seem to do anything or the radio page is broken (stuck when starting and unsresponsive to input) you might be using a custom locale.

Try setting the environment variable LC_NUMERIC to en_US.utf8 before starting Spotify.

Deadlock GUI Thread

Can occur under tiling window managers, such as Awesome, when double-clicking new song or playlist. Edit the file ~/.config/spotify/Users/[1-9]*-user/prefs to add or change the following:

Restart Spotify. This will try to disable song notifications which seem to be the cause of the issue (the lack of a notification daemon to receive them makes the UI thread hang). Note that several causes appear to exist for this problem, and this particular fix only applies to select versions of Spotify client, i3 and Awesome, and it may be that additional root causes exist for the Debian and Ubuntu users reporting this issue. Observed with Spotify 0.9.17.1.g9b85d436 and Awesome 3.4.15 and i3-gaps 4.13-2 and Spotify 1.0.64.407.g9bd02c2d.

Note: As of Spotify 1.0.17.75-2, ui.track_notifications_enabled=false seems to be ignored. On the other hand, some users report not experiencing the deadlock anymore as of Awesome 3.5.6. Deadlocks could be caused by scripts called by Awesome, which rely on buggy spotify dbus properties. See [3].

Note: This issue has multiple causes, so keep track of what you change while researching this. Update this section with additional scenarios and fixes.

Album art and images are missing, show up as squares

Quit spotify, then open spotify preferences ~/.config/spotify/prefs

Change @https to @http:

See original form post here.

Note: As of 1.0.17 it looks like replacing https with http as suggested above can result in no connectivity at all. If this happens an alternative solution is to set 'no proxy' in the GUI use proxychains-ng to force all TCP connection coming from the app through a proxy. Even with HTTP proxies that reject connections on port 80 (and only work for port 443) this works reliably.

Spotify does not detect other devices on local network

If a firewall is in place, open ports 57621 for UDP and TCP. If you use a variant of the iptablesSimple stateful firewall, the following should do it:

It is also possible to restrict the source and destination to the local network.

If you are using Spotify Connect to play music on a wireless speaker or AVR, your firewall needs to be configured for Spotify's mDNS lookup of those. Sadly, it uses a random unprivileged port [4] which makes these firewall rules rather nasty. Fortunately, you can restrict the rules to source port 1900 or 5353.

If you cannot detect other linux clients, this may be due to a bug in Spotify related to the user name launching the instance. Spotify will not detect other instances having the same $HOME environment variable, even on different machines. To circumvent this, either create a dedicated user, or launch Spotify with a different $HOME. The following is a workaround to use your home directory and still be able to detect other devices:

Search Bar text is invisible when using a dark theme

The text in the search bar appears to be hardcoded to be white, making it invisible when using a dark Qt theme. To fix this, you will need to make an override.

First create a css file somewhere your account has permission to read/write from (such as your home folder). Call it whatever you like (eg. spotify-override.css).

Open the newly created css file and add the following:

Save the file and exit. Next, you need to add the following to the end of your Spotify launcher (substitute the path with the actual path of your css file):

So your full launch path should look something like this:

Cannot play local files

This section is being considered for removal.

Reason: Playback of local files works seamlessly on spotifyAUR out of the box without any changes as tested on version 1:1.1.56.595-1. (Discuss in Talk:Spotify#Removal of sections regarding playback of local files)

Arch Linux Hidpi

If you get a segmentation fault or error message when trying to play local files e.g.

- it's caused by a missing libavcodec dependency. For PulseAudio users, installing ffmpeg-compat-57AUR should fix it. If you get PGP verification errors when you install it you might have to import the correct PGP key.

Not respecting window manager rules

Window manager that try to apply specific rules like starting it on a determined workspace or maximizing it on startup, has no effect, as Spotify does not set the WM_CLASS property before creating the window, violating the ICCCM specifications. One solution is to use spotifywm-gitAUR.

GUI hangs while the music plays

Also the previous and next track buttons act with a delay of 10-40 seconds. Spotify by default tries to send notification about next track, if you do not have a notification-daemon installed, Spotify's GUI hangs.

The solution is to either disable notifications in the settings or to install a notification daemon from Desktop notifications.

GUI Borders are gone and app occupies the whole screen over cinnamon panel

If having issue with window borders disappearing and so app goes to a kind of fullscreen but you cannot drag the window or change its size on cinnamon, that may be caused by the preferences located by default at text file /home/yourusername/.config/Spotify/Users/yourusername-user/prefs configs:

What probably happens is, when both resolutions matches your 'main' monitor resolution values or higher, this may happen when going from two monitors to only one monitor. As a solution, close Spotify, edit prefs file to remove both configs above, save it, then run Spotify again.

Cannot open settings in Wayland

Spotify arch

When using Wayland, clicking on the 'Settings' button does nothing. Using the keyboard instead will work (arrows and enter). See [5]

Crashes on startup

If the app crashes on startup and you get the following error message

try to run spotify with the -no-zygote flag.

Spotify crashes when adding a local folder

This section is being considered for removal.

Reason: Playback of local files works seamlessly on spotifyAUR out of the box without any changes as tested on version 1:1.1.56.595-1. (Discuss in Talk:Spotify#Removal of sections regarding playback of local files)

Spotify Arch Linux Aur

When the 'add a source' button inside the Local Files options crashes Spotify. One workaround available is shown in this reddit post. Alternatively you can install the Flatpak version.

Spotify has limited or no internet connectivity while using a VPN

More recent versions of Spotify (noticed after version ~1.1.10) use NetworkManager's detection of internet connectivity for determining if Spotify is able to play songs or even log in. When using a VPN service, Network Manager can fail to correctly identify internet connectivity, stating 'Limited Connectivity'. See NetworkManager#Checking connectivity for possible solutions.

See also

  • Spotify for Linux — Spotify's homepage for the Linux client

Spotify Archwell

Retrieved from 'https://wiki.archlinux.org/index.php?title=Spotify&oldid=669397'