Once in a while you may find that you have an app that has a URI which xdg-open and gnome does not recognize. If you’re running gnome or a gnome-based desktop (like Cinnamon) you can easily add a new handler for it.

Let’s take Spotify URIs for example. They are identified because they start with “spotify:” (just as http URIs start with “http:”). All you need to do is run three commands to get Gnome to recognize that URI:

# specify the command for the matching URI header (where %s represents where the URI will be passed)
gconftool-2 -t string -s /desktop/gnome/url-handers/spotify/command "/usr/local/bin/spotify %s"
# tell gnome that it doesn't require a terminal window
gconftool-2 -s /desktop/gnome/url-handlers/spotify/needs_terminal false -t bool
# enable the handler
gconftool-2 -s /desktop/gnome/url-handlers/spotify/enabled true -t bool

Once you’ve done this you should now be able to have these URIs open Spotify (or your other program) directly. You can test by passing the URI to xdg-open.