Shell – Spotify controls (next, previous etc) via context menu in gnome favorites

desktopgnomegnome-shell

I've added Spotify launcher to Gnome Shell Dash so it's now a favorite app.
How do I add next / prev / play-pause / stop commands to Spotify context menu ?


For those who still find this unclear, the goal here is to have something like this:

enter image description here

Best Answer

After spending some time looking around for the answer I finally managed to make it work.

Just edit your spotify.desktop file under /usr/share/applications

enter image description here

[Desktop Entry]
Name=Spotify
GenericName=Music Player
Comment=Spotify streaming music client
Icon=spotify-client
Exec=spotify %U
TryExec=spotify
Terminal=false
Type=Application
Categories=Audio;Music;Player;AudioVideo;
MimeType=x-scheme-handler/spotify;

Actions=PlayPause;Next;Previous;Stop

[Desktop Action PlayPause]
Name=Play-Pause
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

[Desktop Action Next]
Name=Next
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

[Desktop Action Previous]
Name=Previous
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous

[Desktop Action Stop]
Name=Stop
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop
Related Question