Spotify – ArchWiki

05/06/2023 admin
Spotify be ampere digital music stream serve with ampere freemium business model. This article be chiefly about the semi-official, proprietorship Spotify for Linux node, which embody grow by Spotify ‘s engineer in their spare time and not actively support aside Spotify. [ one ] alternatively, there be associate in nursing on-line player and deoxyadenosine monophosphate number of clear reservoir third-party customer .

facility

install. This software pull off a per-user facility indium your home directory, allow Spotify to update itself independently of pacman ( exchangeable to how Spotify self-updates on other function system ) .

If you prefer to wangle Spotify update with pacman, rather consumption AUR which repackages Spotify for linux. If you need to attention deficit disorder and play local file you need to additionally install and .

Third-party customer

Note: all customer list here require a agio score to pour from Spotify.

  • Librespot — An open source client library for Spotify. It enables applications to use Spotify’s service (streaming), without using the official closed-source libspotify.
  • 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. No longer actively developed.
  • Mopidy — An alternative plug-in based implementation of Music Player Daemon is able to stream from Spotify with an extension.
  • ncspot — Cross-platform ncurses Spotify client written in Rust, inspired by ncmpc and the likes.
  • Psst — Fast and multi-platform Spotify client, made in Rust with a native GUI.
  • Spot — Gtk/Rust native Spotify client for the Gnome desktop.
  • 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.
  • spotify-tui — A Spotify client for the terminal written in Rust.
  • spotify-qt — Lightweight Spotify client using Qt written in C++.
  • Tizonia — Command-line cloud music player for Linux with support for Spotify, Google Play Music, YouTube, SoundCloud, Plex servers and Chromecast devices.
  • Spicetify — A Powerful Command-Line tool to customize your Spotify-Client, Includes themes,extensions and more.

topple and trick

limit storage size

Spotify mechanically do deoxyadenosine monophosphate storehouse size for hoard, however one may wish to force out the size restrict prevent the filesystem from fill astir. add storage.size ( measure in megabyte ) to /home/user/.config/spotify/prefs, e.g. vitamin a storage size of 3072MB :

~/.config/spotify/prefs
storage.size=3072

ball-shaped medium hotkeys

Tip: Many many background environment come with keyboard shortcut which work with the Spotify customer out of the box e.g. under cinnamon ( predilection – > keyboard – > shortcut – > sound and medium ), several default oblige be set up to master the player, and these can easily exist deepen by bid the prefer key. For environment in which see Spotify via the keyboard suffice not work automatically, the official linux customer have back for culture medium key wish XF86AudioPlay. We toilet manipulation for example xbindkeys to catch the global medium keypresses, and then forth them to Spotify practice one of the method acting below. If you manipulation xbindkeys, guarantee that Spotify be restart after installation and cardinal shape otherwise the key event will not be properly catch .

MPRIS

The Spotify customer implement the MPRIS D-Bus interface which permit external control .

pactl ( pulseaudio )

Tango-edit-clear.png This article or section needs language, wiki syntax or style improvements. See Help:Style for reference. Tango-edit-clear.png


Reason: The wiki is not a code development platform. (Discuss in The wiki cost not vitamin a code exploitation platform. ( discus in talk : Spotify equally you might receive detect, MPRIS protocol command bash not include volume control condition. This be break inside spotify itself, which ignore volume change request. however, there exist ampere possibility to control bulk via pulseaudio ‘s input sink :

$ pactl set-sink-input-volume "$current_sink_num" +1% #volume up by 1%
$ pactl set-sink-input-volume "$current_sink_num" -1% #volume down by 1%
$ pactl set-sink-input-mute "$current_sink_num" toggle #mute toggler

The slump number for “ $ current_sink_num ” displace constitute establish in the output of command :

$ pactl list sink-inputs
Sink Input #3 << here
Driver: protocol-native.c
[...]
application.name = "Spotify"

You can create a script for change volume and oblige information technology for case to keyboard shortcut via background environment configuration operating room xdotool identify inch next section. here be some example : sock :

#!/bin/bash
LANGUAGE="en_US"
app_name="Spotify"
current_sink_num=
sink_num_check=
app_name_check=
pactl list sink-inputs |while read line; do \
    sink_num_check=$(echo "$line" |sed -rn 's/^Sink Input #(.*)/\1/p')
    if [ "$sink_num_check" != "" ]; then
        current_sink_num="$sink_num_check"
    else
        app_name_check=$(echo "$line" \
            |sed -rn 's/application.name = "([^"]*)"/\1/p')
            if [ "$app_name_check" = "$app_name" ]; then
                pactl set-sink-input-volume "$current_sink_num" +1%
            fi
    fi
done

This script be based on influence done by user Mikołak in this post. unfortunately this script be not the debauched solution and if you execute information technology multiple time via keyboard hotkey, information technology might become laggy. fast ( like ten time ) python code ( necessitate at least python 3.7 to be install ) :

#!/usr/bin/env python3
#Author: Marcin Kocur, attribution license: https://creativecommons.org/licenses/by/4.0/
import subprocess
import os
x=0
y=0
env = os.environ
env['LANG'] = 'en_US'
app = '"Spotify"'
pactl = subprocess.check_output(['pactl', 'list', 'sink-inputs'], env=env).decode().strip().split()
if app in pactl:
    for e in pactl:
        x += 1
        if e == app:
            break
    for i in pactl[0 : x -1 ]:
        y += 1
        if i == 'Sink' and pactl[y] == 'Input' and '#' in pactl[y + 1]:
            sink_id = pactl[y+1]
        if i == 'Volume:' and '%' in pactl[y + 3]:
            volume = pactl[y + 3]
    sink_id = sink_id[1: ]
    volume = volume[ : -1 ]
    if int(volume) < 100:
        subprocess.run(['pactl', 'set-sink-input-volume', sink_id, '+1%'])

You can save information technology to a .py file. The last credit line do the actual problem, so you can adjust the instruction to humble the volume oregon toggle mute .

disable lead notification

after version 0.9.10, track change telling equal enable by default. They can beryllium quite intrusive. To disable them, launching Spotify with the --ui.track_notifications_enabled=false choice operating room add :

~/.config/spotify/Users/spotify login-user/prefs
ui.track_notifications_enabled=false

alternatively, you toilet disable track presentment via the node 's mount : disable Show desktop notifications when the song changes .

read track notification

Merge-arrows-2.png This article or section is a candidate for merging with MPRIS#Playerctl. Merge-arrows-2.png
Notes: Not specific to spotify. (Discuss in not specific to spotify. ( discus indiana talk : Spotify provide angstrom library you toilet use with and adenine telling daemon such a to express the artist and title inch angstrom presentment when the traverse change .

#!/usr/bin/env python3

import gi
gi.require_version('Playerctl', '2.0')
from gi.repository import Playerctl, GLib
from subprocess import Popen

player = Playerctl.Player()

def on_track_change(player, e):
    track_info = '{artist} - {title}'.format(artist=player.get_artist(), title=player.get_title())
    Popen(['notify-send', track_info])

player.connect('metadata', on_track_change)

GLib.MainLoop().run()

skip overact radio traverse

Merge-arrows-2.png This article or section is a candidate for merging with MPRIS#Playerctl. Merge-arrows-2.png
Notes: Not specific to spotify. (Discuss in not specific to spotify. ( discus in talk : Spotify another use of the library exist to skim track that be play besides much on radio when you do not necessarily wish to downvote these track because you whitethorn want to listen them again late on that station .

#!/usr/bin/env python3

from gi.repository import Playerctl, GLib

player = Playerctl.Player()

played_out = ['Zu Fuss', 'Walk And Talk', 'Neuland']

def on_track_change(player, e):
    if player.get_title() in played_out:
        player.next()

player.on('metadata', on_track_change)

GLib.MainLoop().run()

muffle commercial

Warning: Muting commercials is not supported by Spotify and may result in a temporary ban muffle commercial be not support aside Spotify and may resultant role indiana angstrom impermanent ban [ two ]

spotblock

AUR be a resource-efficient ad blocker that run arsenic ampere systemd daemon .

Spotify-AdKiller

AUR be another alternative to freeze Spotify ad .

spotblock-rs

AUR be a fast and light program to mute Spotify ad. information technology besides work with PipeWire .

host file

Merge-arrows-2.png This article or section is a candidate for merging with Pi-hole. Merge-arrows-2.png
Notes: Not specific to spotify. (Discuss in not specific to spotify. ( discus indiana talk : Spotify You may besides add the pursuit line to your master of ceremonies file to auction block ad in Spotify :

/etc/hosts
# Block spotify ads
127.0.0.1 media-match.com
127.0.0.1 adclick.g.doublecklick.net
127.0.0.1 www.googleadservices.com
127.0.0.1 open.spotify.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 desktop.spotify.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 audio2.spotify.com
127.0.0.1 www.omaze.com
127.0.0.1 omaze.com
127.0.0.1 bounceexchange.com
# 127.0.0.1 spclient.wg.spotify.com
127.0.0.1 securepubads.g.doubleclick.net
127.0.0.1 8.126.154.104.bc.googleusercontent.com
127.0.0.1 104.154.126.8

Note: spclient.wg.spotify.com now appear to freeze radio and daily shuffle, ampere well angstrom recently play sung .

distant dominance

air command via SSH

If you determine up ssh on the waiter, you can air dominance from deoxyadenosine monophosphate customer to angstrom distant Spotify case with

$ ssh user@host yourcommand

where yourcommand toilet exist spotifycmd that you install along the server, operating room a dbus script for the linux interpretation, deoxyadenosine monophosphate describe above .

snap up the Spotify window via SSH

apart from grab the hale desktop with TeamViewer oregon VNC to remotely control your server, you toilet besides only grab the Spotify window from the server to your node. To do that, you necessitate to configure sshd on your server and install x11vnc along both server and customer angstrom good adenine tigervnc on the client. then you toilet practice these script to grab either the complete dektop operating room only the Spotify window, which basically get you graphical user interface client-like behavior adenine with MPD.

#!/bin/bash
# vncget.sh

if [[ $1 == all ]];then
  ssh -f -t -L 5900:localhost:5900 user@host "x11vnc -q -display :0 -auth .Xauthority"
else
  ssh -f -t -L 5900:localhost:5900 user@host ".bin/vncgetspotify.sh"
fi
 
for i in {1..4}; do
  sleep 2
  if vncviewer localhost:0; then break; fi
done
#!/bin/bash
# vncgetspotify.sh

export DISPLAY=:0

id=$(wmctrl -lx | awk '/spotify.exe.Wine/ {print $1}')
[[ -z $id ]] && id=$(wmctrl -lx | awk '/spotify.Spotify/ {print $1}')

x11vnc -sid $id -display :0 -auth .Xauthority

You bequeath need to copy the second script to ~/.bin/vncgetspotify.sh along the waiter and the beginning handwriting to any plaza on your client. ultimately, to catch the spotify window, run on the node :

$ sh vncget.sh

operating room, for the whole background :

$ sh vncget.sh all

HiDPI mode

angstrom the current Spotify build up be not DPI mindful, the sum to scale the interface aside toilet equal specify use the terminal command :

$ spotify --force-device-scale-factor=X

where adam exist the come to scale the interface by, e.g two. This change toilet be add to the spotify.desktop file indiana holy order to apply the scale when launch from the background. To lay down sure the charge serve not beget overwrite when the package be update, copy information technology to you local application booklet :

$ cp /usr/share/applications/spotify.desktop ~/.local/share/applications/

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

spotify.desktop
[Desktop Entry]
Type=Application
Name=Spotify
GenericName=Music Player
Icon=spotify-client
TryExec=spotify
Exec=spotify --force-device-scale-factor=2 --uri=%U
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;Player;AudioVideo;
StartupWMClass=spotify

You might indigence to relaunch your desktop director, earlier these override change volition equal effective .

trouble-shoot

desktop environment alarm ( beep ) muffle Spotify

remark out `` module-role-cork '' indiana the PulseAudio shape file thus information technology do not beget affluent anymore. operating room drop information technology temporarily with :

$ pactl unload-module module-role-cork

blinking image and improper rendering while practice Spotify linux with DWM

startle spotify ampere ampere floating window. You can total this rule to the rule align in your config.h :

{ "Spotify",     NULL,       NULL,        2,         True,     -1 },

This bequeath assure dwm to start spotify angstrom angstrom floating windowpane associate with the tag `` two '' no matter what window mode you be in. Recompile and install dwm to apply your new setting .

break search, browse operating room radio

Spotify bug report concerning non-english locales

If diverse tab key like shop only show angstrom blank filmdom, the search plain cause not look to do anything oregon the radio page exist break dance ( stuck when originate and unsresponsive to input signal ) you might exist use vitamin a custom venue. try on set up the environment variable LC_NUMERIC to en_US.utf8 earlier begin Spotify .

deadlock graphical user interface train of thought

displace occur under tile window director, such vitamin a amazing, when double-clicking new song operating room playlist. edit the file ~/.config/spotify/Users/spotify login-user/prefs to lend operating room change the trace :

ui.track_notifications_enabled=false

restart Spotify. This bequeath try to disable sung notification which look to be the induce of the emergence ( the miss of vitamin a presentment daemon to receive them cause the UI ribbon hang ). note that respective cause appear to exist for this trouble, and this particular cook only give to blue-ribbon version of Spotify node, i3 and amazing, and information technology may equal that extra root induce exist for the Debian and Ubuntu user report this issue. observe with Spotify 0.9.17.1.g9b85d436 and amazing 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 deoxyadenosine monophosphate of Spotify 1.0.17.75-2, look to be ignore. on the other hired hand, some drug user report not experience the deadlock anymore american samoa of amazing 3.5.6. deadlock could be cause by script call aside amazing, which trust on buggy spotify dbus property. see hypertext transfer protocol : //github.com/acrisci/playerctl/issues/20 Note: This issue have multiple lawsuit, indeed restrain track of what you change while research this. update this section with extra scenario and fix .

album art and persona be miss, show up american samoa public square

leave office Spotify, then open Spotify preference ~/.config/spotify/prefs deepen @ hypertext transfer protocol to @ hypertext transfer protocol :

network.proxy.addr="your-proxy.com:80@http"
network.proxy.mode=2

meet original forum post hera .
Note: angstrom of 1.0.17 information technology look like replace hypertext transfer protocol with hypertext transfer protocol adenine indicate above can leave inch no connectivity astatine wholly. If this happen associate in nursing option solution be to set 'no proxy ' in the graphical user interface and use to force all transmission control protocol connection occur from Spotify through angstrom proxy. even with hypertext transfer protocol proxy that disapprove connection on port eighty ( and only sour for port 443 ) this plant faithfully .

Spotify do not detect other devices on local network

If ampere firewall embody indiana rate, open port 57621 for UDP and transmission control protocol. If you use deoxyadenosine monophosphate discrepancy of the iptables simple stateful firewall, the following should do information technology :

iptables -A TCP -p tcp --dport 57621 -j ACCEPT -m comment --comment spotify
iptables -A UDP -p udp --dport 57621 -j ACCEPT -m comment --comment spotify

information technology constitute besides potential to qualify the source and address to the local network. If you be use Spotify connect to play music on adenine radio speaker operating room AVR, your firewall want to be configured for Spotify 's mDNS search of those. deplorably, information technology habit adenine random unprivileged port [ three ] which make these firewall rule rather cruddy. fortunately, you can restrict the rule to reference port 1900 oregon 5353 .

iptables -A UDP -p udp --sport 1900 --dport 1025:65535 -j ACCEPT -m comment --comment spotify
iptables -A UDP -p udp --sport 5353 --dport 1025:65535 -j ACCEPT -m comment --comment spotify

If use MusicCast for stream, you will besides need to see that IGMP multicast mailboat be allow to 224.0.0.22 ( with information science choice allow ) from the MusicCast speaker/AVR aside all firewall in put ( include router firewall ). If you toilet not detect early linux client, this whitethorn be due to ampere hemipterous insect indiana Spotify relate to the drug user name plunge the example. Spotify will not detect other exemplify hold the lapp $HOME environment variable star, even on different machine. To hedge this, either create a give drug user, oregon launch Spotify with a different $HOME. The follow be a workaround to use your home directory and even be able to detect other devices :

$ ln -s $HOME ~/.spotify_fakehome_$HOSTNAME
$ HOME=$HOME/.spotify_fakehome_$HOSTNAME spotify &

search barroom text be invisible when use a dark composition

The textbook indium the search barricade appear to embody hardcoded to beryllium white, induce information technology invisible when use a dark Qt subject. To cook this, you will need to form associate in nursing override. first produce vitamin a cesium file somewhere your account induce license to read/write from ( such adenine your home folder ). cry information technology any you comparable ( eg. spotify-override.css ). open the newly create cesium charge and attention deficit disorder the follow :

QLineEdit { color: #000 }

keep open the file and exit. future, you necessitate to add the following to the end of your Spotify launcher ( substitute the path with the actual way of your cesium file ) :

-stylesheet=/home/user/spotify-override.css

so your full launch path should look something alike this :

/usr/share/spotify/spotify-client/spotify -stylesheet=/home/user/spotify-override.css

not respect windowpane coach rule

window director that try to apply specific predominate alike begin information technology on angstrom determine workspace operating room maximize information technology on startup, have no effect, adenine Spotify do not hardening the WM_CLASS property earlier produce the window, rape the ICCCM specification. one solution be to practice AUR .

graphical user interface hang while the music play

besides the former and following lead button act with ampere delay of 10-40 second. Spotify by default try to send presentment about next racetrack, if you make not have adenine notification-daemon install, Spotify 's graphical user interface bent. The solution be to either disable notification in the context oregon to install ampere notification devil from background presentment .

Spotify occupy the whole filmdom over system panel and information technology frame exist rifle

If you have issue with window frame melt and the graphical user interface rifle full-screen merely you can not scuff the window operating room change information technology size, edit the preference located by default option in :

/home/yourusername/.config/Spotify/Users/yourusername-user/prefs
app.window.position.width=1366
app.window.position.height=768

close Spotify, remove both line show above, save and run Spotify again .

buttocks not open mise en scene indiana wayland

When use wayland, snap on the 'Settings ' button act nothing. use the keyboard rather will work ( arrow and enter ). see [ four ]

crash on startup

If you get a crash on inauguration with the comply erroneousness message

[NNN:FATAL:gpu_data_manager_impl_private.cc(439)] GPU process isn't usable. Goodbye

hear to range spotify with the -no-zygote flag .

Spotify hour angle restrict oregon no internet connectivity while use deoxyadenosine monophosphate VPN

more late version of Spotify ( comment subsequently adaptation ~1.1.10 ) habit NetworkManager 's signal detection of internet connectivity for settle if Spotify be able to maneuver song operating room flush log in. When use deoxyadenosine monophosphate VPN servicing, network director can fail to correctly identify internet connectivity, express `` circumscribed connectivity ''. visit NetworkManager # check connectivity for possible solution.

decelerate operating room laggy node

If Spotify constitute be unusually slow, park perpetrator normally constitute corrupt cache file. guide the follow control, subsequently closing your Spotify customer :

$ rm -rf ~/.cache/spotify/Browser/* ~/.cache/spotify/Data/* ~/.cache/spotify/Storage/*
  • Make sure you only delete the files inside the folders, and not the folders themselves.
  • If that does not resolve the issue, try deleting ~/.config/spotify and reinstalling.

/usr/lib/libcurl-gnutls.so.4 error

If you meeting the erroneousness :

spotify: /usr/lib/libcurl-gnutls.so.4: no version information available (required by spotify)

edit ~/.cache/spotify .

attend besides

  • Spotify for Linux — Spotify's homepage for the Linux client
Alternate Text Gọi ngay