How to get Spotify URLs working again in Ubuntu 11.04

I’m using the native Spotify client for Linux (available here), which is only available to paying subscribers at the moment, apparently due to some problems in getting commercials to work reliably or something like that, but that’s not the topic of this post.

Ever since I upgraded to Natty I haven’t been able to get Spotify-URIs to work. That is, links that look like this:
spotify:user:einarjh:playlist:7iWZ9zuOOILXU5hbzruuxE. Today I found the corresponding bug: Bug #788673 in xdg-utils.

This is how you fix it:

Create the file /usr/share/applications/spotify-url.desktop and add the following content:

[Desktop Entry]
Name=Spotify
GenericName=Spotify
Comment=Listen to music using Spotify
Icon=spotify-linux-512x512
TryExec=spotify
Exec=spotify -uri %u
Terminal=false
Type=Application
Categories=Qt;AudioVideo
MimeType=x-scheme-handler/spotify
NoDisplay=true

That’s it! Enjoy your working Spotify URIs!