Right now Chrome throws its apron over its head and calls Firefox, which opens the link with rtorrent. What do I need to do to eliminate the Firefox step?

  • what version of Google chrome are you running? google-chrome -version – Alvar May 8 '12 at 8:14
  • This happened to me (on Ubuntu 14.04.2 LTS) when Firefox was set as my default browser. If Chromium was set as my default browser, then I only got a new empty tab in Chromium. -- In the end I solved the problem by patching my /usr/bin/xdg-open as suggested in the accepted answer to "Torrent magnet links open new window but not transmission". – zrajm May 31 '15 at 13:54

10 Answers 10


Chrome (or Chromium) protocol handling works differently than in Firefox. Firefox basically keeps track of all that itself, which is why you can configure protocol handling (like magnet links) in the Applications part of the Preferences. Chrome, however, relies on xdg-open.

There are a couple things that you need to do before xdg-open will handle magnet links properly.

  1. Find the name of the desktop file of the program you want to handle the magnet link. Let's suppose the program is Transmission. It (like usual) has its desktop file in /usr/share/applications/ and in fact, by perusing the listing of the directory, I find that my version of transmission is actually the gtk version, so its desktop file is called transmission-gtk.desktop.

  2. It's possible the desktop file is messed up. So you can check that /usr/share/applications/transmission-gtk.desktop contains the lines:

    Exec=transmission-gtk %U
    [some lines omitted]

    Note the %U in the Exec line. It's absolutely necessary. The MimeType line should look as above.

  3. Now for the essential step to tell xdg-open to open magnet links using Transmission. In the terminal, type:

    xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet 
  4. (Step not necessary if you use Gnome, KDE, Xfce, or LXDE) Lastly, xdg-open assumes you are running one of the standard desktop environments: gnome, kde, xfce and lxde. If you are not, xdg-open will not work on magnet links. As suggested on the Arch wiki, you can simply modify /usr/bin/xdg-open. At the end of the file, you'll find a portion that starts with:

    if [ x"$DE" = x"" ]; then

    change generic to one of gnome, kde, xfce, or lxde. I chose xfce since I actually have an Xfce session that I've configured and use on occasion.

    The downside to this approach is that if xdg-open gets updates, you'll have to redo this. The Arch wiki suggests another approach that avoids this flaw (but has its own downside).

    Warning: The choice in the last step is more important than it might seem. Picking lxde did not work for me! In xdg-open, the helper function open_lxde relies on pcmanfm (lxde file manager) and something is wrong with either the code in open_lxde or perhaps it's pcmanfm's fault.

  • 7
    Thank you! I just did a xdg-mime default deluge.desktop x-scheme-handler/magnet to associate it with Deluge instead. – Justin Force Jan 1 '13 at 5:34
  • 1
    I'm having a (probably) related problem. I've tried your solution but it's not working. – Quinn Culver Jul 13 '13 at 15:46
  • 2
    How can Linux succeed, when experts let alone noobs can't make it work. I use Linux by preference every day, but the desktop experience is not good enough. Good luck to SteamOS. – Sam Watkins Nov 29 '13 at 11:05
  • 2
    Also wanted to say thanks for the answer, it worked great. Since I'm on Linux Mint using MATE instead of GNOME, I had to do step 4. Strangely, mate didn't work (which I would have expected since I run MATE), but gnome did. – machineghost Jan 18 '14 at 20:16
  • 1
    @machineghost thanks for your comment: i'm on MATE too and this answer + your comment sorted it for me. – Max Williams Apr 7 '14 at 10:04

just drag the magnet link into Transmission window and it works fine for me without any tweaks.... I am using a stock build of Lubuntu 12.10 nothing fancy....

  • This is another approach and I like it. But it doesn't solve the issue when the magnet link is opened automatically and it requires much user interaction (clicks) when transmission isn't already running. – Joel Sjögren Jul 22 '13 at 8:11

Worked very nice to open magnets from Chrome with qBitorrent in Lubuntu

xdg-mime default qBittorrent.desktop x-scheme-handler/magnet


if you use xfce and don't want to mess anything, you could use my solution. I fixed by manually editing xdg-open as follows:

First of all make sure you have the mime associated (as explained before, with xdg-mime)

Then backup xdg-open as root (sudo if that applies)

# cp /usr/bin/xdg-open /usr/bin/xdg-open.old

Finally, edit as root /usr/bin/xdg-open, find open_xfce() and add the lines marked with +, e.g., with nano

# nano /usr/bin/xdg-open

+ if [ "\`echo $1 | sed -n 's/\(^[[:alnum:]+\.-]*\):.*$/\1/p'\`" == "magnet" ]; then
+     gnome-open "$1"
+ else
      exo-open "$1"
+ fi

it only adds the exception for the magnet links, so they will be opened with gnome-open instead of exo-open.

Hope it helps.


None of the other suggestions I found worked for me, but this did the trick under Debian / Xfce ( from http://fluxcode.net/archives/57 ):

In /usr/bin/xdg-open add the following lines to open_xfce()

 if(echo "$1" | grep -q '^magnet:'); then
    transmission-gtk "$1" 
    if [ $? -eq 0 ]; then

exo-open "$1"

A guy in alt.os.linux.slackware found the solution:


  • Welcome to Ask Ubuntu! While this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Michael Martin-Smucker Mar 2 '12 at 3:10
  • This is actually more complicated than needed. See my answer. – Chan-Ho Suh May 8 '12 at 8:09

Using gnome-open on XFCE worked out for me.

This can be forced with editing /usr/bin/xdg-open and change

if [ x"$DE" = x"" ]; then


if [ x"$DE" = x"" ]; then

This works for me in ubuntu 18 with FF (for deluge):

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

I know that doesn't answer the question but I use Chrome too and this is a better work around than copying and pasting the magnet link.


I mixed few answers (that unfortunately didn't work for me) and came up with something that made it work like a charm! It worked on Linux Mint 16 under XFCE, anyways.

Make backup of xdg-open under /usr/bin, open your xdg-open with sudo and then make open_xfce() function exactly like this:

    if (echo "$1" | grep -q '^magnet:'); then
        gnome-open "$1"
        exo-open "$1"

It's dirty and you need to edit it every xdg-open update, but hey, it works!


I've tried for years to fix this and switch to Chrome and nothing seems to work. I finally had a thought I'm not sure why I didn't think of before and it works great. I'm using Tixati in Mint but it should work universally. Chrome points magnet links to usr/bin/transmission-gtk so I renamed that to transmission-gtk.old and renamed tixati to transmission-gtk and picked the option in chrome to always do this and hit launch app and now mag links go straight into Tixati just like Firefox. Problem finally solved!

Not the answer you're looking for? Browse other questions tagged or ask your own question.