Ubuntu – How to configure Chrome to open magnet URI’s with Deluge

bittorrentchromiumdelugetransmission

After upgrading to Ubuntu 11.04 (natty) from 10.10, I can no longer open magnet (torrent) links in Chromium, and set deluge to automatically open and accept the URL.

(Edit: currently ".torrent" files are not a problem, but magnet URL's, e.g. of the form "magnet:?xt=urn:...", are now the only problem. Not sure if something updated…?)

Rather, now only transmission will automatically open torrents, magnet links, etc. There doesn't seem to be a way to set deluge to be the default torrent client. (And, there also doesn't seem to be a "default application" setting for BitTorrent client to replace transmission w/ deluge.)

Notes:

  • I found some old threads on this issue, and only a one or two newer ones. The newer threads seem to suggest xdg-open is to blame. But not many people seem to be running into this problem, so… maybe it's just me?
  • Not using Firefox, so manually setting apps for mime-types or extensions doesn't work (that's not an option in chrome/chromium, AFAIK — you have to rely on the OS)
  • I uninstalled transmission, and then basically nothing happened when clicking on torrent/magnet links.
  • running from the shell also opens transmission (not deluge): xdg-open "magnet:?xt=urn:bt..&tr=http://tracker.....com/announce".

My current URL handlers are:

$ gconftool -a /desktop/gnome/url-handlers/magnet
command = deluge "%s"
needs_terminal = false
enabled = true

The only work-around I have (which does work) is to rename /usr/bin/transmission-gtk{,.bak} and create my own /usr/bin/transmission-gtk:

$ cat /usr/bin/transmission-gtk
#!/bin/bash
deluge "$@"

Anyone else run into this, know of a bug, workaround, or…?

Best Answer

For 12.04 up to 16.04

In 12.04 and 13.04, deluge does include x-scheme-handler/magnet=deluge.desktop; in the desktop file. In my case, transmission was still opening magnet links. I had to tell gvfs-open preferring deluge with:

gvfs-mime --set x-scheme-handler/magnet deluge.desktop

For 18.04

gvfs-mime was deprecated and 'gio mime' used instead:

gio mime x-scheme-handler/magnet deluge.desktop