40

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...?

Pablo Bianchi
  • 17,371
michael
  • 2,109

16 Answers16

38

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
Pablo Bianchi
  • 17,371
18

The answer is in fact a bug in deluge packaging (or, perhaps deluge is the same & everything else changed around it... depends on your perspective, I guess.) See the forum topic here for the details.

Basically, setting up xdg-open's config via gconf-editor didn't do anything to resolve the issue, since as of Natty the file-open functionality is handled by gvfs-open, which doesn't use gconf settings. Rather, gvfs-open looks at the ".desktop" files bundled with each application to determine what file types can be handled (if not installed, run sudo apt-get install gvfs-bin).

From the forum posting, the /usr/share/applications/deluge.desktop file has a couple issues; it should say Exec=deluge-gtk %U (rather than just "Exec=deluge-gtk") so that the argument is passed to the application. Second, rather than just MimeType=application/x-bittorrent; it should say MimeType=application/x-bittorrent;x-scheme-handler/magnet;.

The update should be coming through soon... Here is the link to the updated desktop file should you want to make the change yourself; just run sudo update-desktop-database and everything just starts working (don't even have to restart chrome/chromium).

Rinzwind
  • 309,379
michael
  • 2,109
8

Ubuntu

Recently it is also needed to add the following line to ~/.local/share/applications/mimeapps.list under [Added Associations]

x-scheme-handler/magnet=deluge.desktop;

Kubuntu

On Kubuntu however, you have to create the following file in ~/.kde/share/kde4/services/magnet.protocol

[Protocol]
exec=deluge "%u"
protocol=magnet
input=none
output=none
helper=true
listing=false
reading=false
writing=false
makedir=false
deleting=false

Note: Don't forget to relog after these changes.

4

I'm using Ubuntu 13.04, and after installing Deluge, I just only need to run this command in order to get Chromium use Deluge to open magnets:

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

Hope this helps :)

jelies
  • 151
  • 4
3

I did all of this and it didn't work.

After having tried everything else I saw, I finally managed to make magnet links open in deluge not only by changing

MimeType=application/x-bittorrent;

to

MimeType=application/x-bittorrent;x-scheme-handler/magnet;

in /usr/share/applications/deluge.desktop, but also by removing

x-scheme-handler/magnet;

from /usr/share/applications/transmission-gtk.desktop before running

sudo update-desktop-database
kos
  • 41,268
simon
  • 51
2

Download and install this userscript. Now you should be able to quickly add torrent files to Deluge 1.2+ WebUI in Chrome!

Tested on 11.10. For other OS'es you must try out yourself, but I expect it'll work fine on them too.

Yi Jiang
  • 1,206
2

This was supposed to be a comment, but I needed to upload a pic, so here it goes:

  • In my setup, both FireFox 3.6 and Chromium 11.0 opened Deluge

  • Chromium asked for a confirmation that gives us a hint of whats going on:

enter image description here

This shows that Chromium does NOT launch Deluge directly... it relies on xdg-open for that. Meaning all that must be researched (and fixed) is the OS, not Chromium. Nothing to fix or change in the browser.

This is not an answer, but it will focus your efforts in the right place... what you must fix have nothing to do with the Browser, but the OS.

MestreLion
  • 20,726
1

On Ubuntu 10.04 with Deluge and chrome I had to do:

gconftool -t string -s /desktop/gnome/url-handlers/magnet/command "deluge-gtk '%s'"
jokerdino
  • 41,732
jpgunter
  • 111
1

I'm on 10.10, tried a bunch of things, this was what worked:

gconftool-2 -t string -s /desktop/gnome/url-handlers/magnet/command "/usr/bin/deluge-gtk %s"
gconftool-2 -s /desktop/gnome/url-handlers/magnet/needs_terminal false -t bool
gconftool-2 -t bool -s /desktop/gnome/url-handlers/magnet/enabled true
jokerdino
  • 41,732
1

I don't think this really solves the issue, but at least it works for me (lubuntu 12.04):

  • Hover your mouse over the magnet link until the magnet address is shown at the bottom of your screen.
  • Right-click and select "Copy link address".
  • Open Transmission and under "File" select "Open URL".
  • Paste the URL in the box and start downloading.

By the way, I fear I'm necroposting a little right now, but the above solutions didn't work for me and my answer might be useful to others, since this page was the first result when I searched this issue on Google.

1

In Linux Mint 16 Petra, I had to edit the Transmissions.desktop file in the applications folder, but also in /usr/share/applications/mimeinfo.cache, rather than mimeapps.list

Also, there is another mimeinfo.cache file in /home/[user]/.local/share/applications that can be edited as well, but I assume this would only affect the current user, where as the one in the applications folder affects all users.

Hope this helps out.

EDIT:

Haa, it appears this functionality was built into the latest versions of Deluge. You can go to Edit -> Preferences -> Other -> and associate default magnet links with Deluge.

0

It looks like now the latest releases (ppa) of Deluge did address the points of the selected answer. However that didn't solve my problem with Google Chrome not launching Torrents in my Ubuntu Precise 12.04.

Rather it looked like the xdg-mime used by xdg-open was not set properly. I found here a working solution. i.e.

$ xdg-mime default deluge.desktop x-scheme-handler/magnet
$ xdg-mime default deluge.desktop application/x-bittorrent

Then a quick check

$ xdg-mime query default x-scheme-handler/magnet
deluge.desktop
$ xdg-mime query default application/x-bittorrent
deluge.desktop

And now it's at last working fine.

Antonio
  • 1,656
0

for me what worked is i went to mimeapps.list file and added tixati as the default magnet handler - its very easy and works fast .

Create desktop shortcut link of the bittorrent client then .

Go to this file --** ( press Ctrl+H ) to show/hide files from view..

/home/.local/share/applications/mimeapps.list

Open the file -mimeapps.list - type this text * x-scheme-handler/magnet=tixati.desktop

click save to the application.

I use tixati for torrent . if u use another bittorrent client -- just replace tixati with other - eg vuze , deluge, . (download tixati from tixati.com )

If you wish to choose transmission then replace tixati with transmission-gtk.desktop

frank
  • 1
0

Here's @michael_n 's answer in one script :

# rewrite deluge's .desktop file
sudo tee /usr/share/applications/deluge.desktop > /dev/null <<'EOF'
[Desktop Entry]
Version=1.0
Name=Deluge
GenericName=BitTorrent Client
X-GNOME-FullName=Deluge BitTorrent Client
Comment=Download and share files over BitTorrent
TryExec=deluge-gtk
Exec=deluge-gtk %U
Icon=deluge
Terminal=false
Type=Application
Categories=Network;FileTransfer;P2P;GTK
StartupNotify=true
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
EOF

# set association and reload
gvfs-mime --set x-scheme-handler/magnet deluge.desktop
sudo update-desktop-database

Woked for me on ubuntu 15.10 with default installs for chrome and deluge.

-1

My Chrome was using Transmission by default. I wanted to use qBittorrent. On Ubuntu 14.04 I removed Transmission using:

sudo apt-get purge transmission-gtk

Then I 'manually' started qBittorrent and closed it again. The next time I clicked a magnet link I was prompted by Chrome to allow it to call an external application. I allowed this and chrome then fired up qBitorrent.

So it seems that if you don't need to have more than one torrent client on your PC, by removing the others and leaving the one you want, you can force Chrome to use the desired client. A bit of a Chuck Norris solution, but it worked for me.

TheGurkha
  • 3
  • 4
-2
cd /usr/bin/

sudo sed 's/elif \[ x\"\$GNOME_DESKTOP_SESSION_ID\" \!\= x\"\" \]\; then DE\=gnome\;/elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;\n    elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;/g' -i xdg-*

Worked for me (Mint Mate 16 Petra).