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?
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?
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.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 calledtransmission-gtk.desktop
.It's possible the desktop file is messed up. So you can check that
/usr/share/applications/transmission-gtk.desktop
contains the lines:Note the
%U
in the Exec line. It's absolutely necessary. The MimeType line should look as above.Now for the essential step to tell
xdg-open
to open magnet links using Transmission. In the terminal, type:(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:change
generic
to one ofgnome
,kde
,xfce
, orlxde
. I chosexfce
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! Inxdg-open
, the helper functionopen_lxde
relies onpcmanfm
(lxde file manager) and something is wrong with either the code inopen_lxde
or perhaps it'spcmanfm
's fault.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....
Worked very nice to open magnets from Chrome with qBitorrent in Lubuntu
In Ubuntu 20.04, run one of the following commands.
Webtorrent
xdg-mime default webtorrent-desktop.desktop x-scheme-handler/magnet
Transmission
xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet
Any other torrent application
X.desktop
file must exist in the/usr/share/applications
directoryif 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
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()
A guy in alt.os.linux.slackware found the solution:
http://www.void.gr/kargig/blog/2012/01/24/open-magnet-urls-with-xdg-open/
Using gnome-open on XFCE worked out for me.
This can be forced with editing /usr/bin/xdg-open and change
to
This works for me in ubuntu 18 with FF (for deluge):
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:
It's dirty and you need to edit it every xdg-open update, but hey, it works!