Spotify
Spotify is a digital music streaming service that provides a proprietary Linux client.
Installation
USE flags
USE flags for media-sound/spotify Spotify is a social music platform
libnotify
|
Enable desktop notification support |
local-playback
|
Allows playing local files with the Spotify client |
pax-kernel
|
Triggers a paxmarking of the main Spotify binary |
pulseaudio
|
Controls the dependency on pulseaudio or apulse |
Emerge
Install Spotify:
root #
emerge --ask media-sound/spotify
Please ensure that net-misc/curl is built with the bfd linker (default) instead of the gold linker. See bug #651770 for more information.
Control via MPRIS
MPRISis a D-Bus interface which provides a common API to control media players.
Spotify supports MPRIS.
Prequisites if using a window manager
In $HOME/.xinitrc, make the window manager start with dbus-run-session.
Otherwise, Spotify won't provide an MPRIS interface.
exec dbus-run-session bspwm
With dbus-send
The most simple approach to controlling Spotify is using dbus-send.
Play/pause:
user $
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
Next:
user $
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
Previous:
user $
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
With playerctl
Install media-sound/playerctl.
Play/pause:
user $
playerctl play-pause
Next:
user $
playerctl next
Previous:
user $
playerctl previous
More info about playerctl can be found on its GitHub page.
Starting with Wayland
Spotify uses Xorg by default. In order to make Spotify start with Wayland, you can add
--enable-features=UseOzonePlatform --ozone-platform=wayland
to Spotify's .desktop file in /usr/share/applications/spotify.desktop on the
Exec=spotify
line. It should look like this:
Exec=spotify --enable-features=UseOzonePlatform --ozone-platform=wayland %U
You can also add these options to anything that launches Spotify through the command line.