Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
    
This may seem a dumb question, but... what if you right-click a .torrent file in nautilus, go for properties, "Open With" tab, and select Deluge? Does it work? Does Deluge at least shows in that list? –  MestreLion May 29 '11 at 5:09
1  
Not a dumb question... The problem is only with magnet url's; ".torrent" files are not a problem. With the magnet url's, there is no file to download. It's like "ftp://..." or "https://..." or file://...". Using nautilus, I can double-click and deluge opens the torrents; using "xdg-open foo.torrent", torrent files are opened correctly with deluge. However using links like "magnet:?..." or even "xdg-open 'magnet:?...'", transmission opens regardless of any gconf settings I make. (I'll see if I can clarify this in the question...) –  michael_n May 30 '11 at 8:46
    
Actually, originally torrent files were also a problem; but now, surprisingly, torrent files do indeed work. I don't know if something changed (it would have to be xdg-open?) ...or if I changed something to make it start working. So, now I can use torrent files as a work-around. Magnet links are (obviously?) better to use in certain situations, though... would be nice to find out if that is indeed a bug or my (broken) configuration. –  michael_n May 30 '11 at 8:58
    
Hum, nice clarification. Yes Im aware of what magnet links are.. its similar to apt links. Im just not sure WHO handles them - the OS or the Browser. I mean... do the browser tell passes the magnet request to OS, or does it handle and launches the app itself? In that question it may lie your answer. Meanwhile, Ill check the behaviour of my FF and Chromium –  MestreLion May 30 '11 at 9:04
    
Firefox handle's its own application launchers (or... at least it used to?)... I just googled again and found a recent forum posting with the answer (see below...) Thanks for the comment, it forced me to look into this again. I had just been living with manually opening the magnet links. Kind of a pain. –  michael_n May 30 '11 at 9:19

14 Answers 14

For 12.04 and above

In 12.04 and 13.04, deluge does included 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 to prefer deluge with:

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

share|improve this answer
up vote 13 down vote accepted

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

share|improve this answer
    
Humm, nice! +1 for that (but it sucks when you have to answer your own question, doesnt it?). Anyway... if Natty requires that .desktop files now have parameters in the Exec statement, wow, basically ALL of my software wont work (I use Mint 10) –  MestreLion May 30 '11 at 9:22
    
It makes no sense for Natty to require parameters in the Exec statement. ITs a huge change that will require rewriting every .desktop for every application. Would be much better to leave the files untouched and tweak gvfs-open call to automatically append any passed parameter to the command in the Exec statement. At least untill ALL applications are fixed. –  MestreLion May 30 '11 at 9:27
    
I should mention that I also installed this to make it work (if you don't have this, you may get different results): sudo apt-get install gvfs-bin –  michael_n May 30 '11 at 9:38
2  
If you don’t want to mess with files in /usr you can also copy the .desktop file to .local/share/applications/ and run update-desktop-database .local/share/applications after that. –  Bombe Feb 2 '12 at 6:11
    
@Bombe: nice approach. And you probably don't even need to update-desktop-database. Gnome usually has daemons that auto-refresh the menus when new files are dropped in that directory. –  MestreLion May 9 '12 at 3:59

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.

share|improve this answer
    
worked for me on Ubuntu 12.04 –  Neutralizer Jun 7 at 18:22

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.

share|improve this answer
    
you can add pics in comments ;) –  Rinzwind May 30 '11 at 9:19
    
you can? wow! How? Anyway, that would look awful i think :P –  MestreLion May 30 '11 at 9:28
    
It's interesting that this says that xdg-open is used to open the magnet links.... I can't get that dialog, since my chromium "remembers" my preference for automatically opening magnet urls..! (And, yes, I tried "clear auto-opening settings", even after managing to get it to be un-greyed...) But as part of my "fix" in my answer, I did also install gvfs-open (sudo apt-get install gvfs-bin). Now, if you check the shell script for /usr/bin/xdg-open, the function "open_gnome()" just calls gvfs-open (if it exists), otherwise it calls gnome-open. (What a mess...) –  michael_n May 30 '11 at 9:35
1  
see Oli's comment: meta.askubuntu.com/questions/1396/how-do-i-add-images-to-posts ;) –  Rinzwind May 30 '11 at 9:36
    
@michael_n: thats why i posted the screenshot.. i figured it would help you to know for sure that Chromium relied on xdg-open (as it should indeed... non-standard URI's must be handled by OS, not Browser) –  MestreLion May 30 '11 at 9:44

did all of this and it didn't work.

after trying everything else i had seen i finally managed to make magnet links open in deluge by not only changing

MimeType=application/x-bittorrent;

to

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

in /usr/share/applications/deluge.desktop but also removing x-scheme-handler/magnet; from /usr/share/applications/transmission-gtk.desktop before running sudo update-desktop-database

hope this helps anyone with similar problems

share|improve this answer

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'"
share|improve this answer
    
That worked for me too. Thanks for sharing. –  uvasal Mar 2 '12 at 21:04

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.

share|improve this answer

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
share|improve this answer

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 :)

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
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).

share|improve this answer
1  
Holy sh*t, mate, whoever told you to run this should be added to your "block" list. I stopped reading at cd /usr/bin; sudo sed ... xdg-* ... not every file xdg-* is actually a shell script; some are binary. You need to fix your system if you actually run something like this (you might be ok, since it may not have changed the files at all...) In any case, *_DESKTOP_SESSION_ID is unrelated afaik to the topic at hand, but even so, you just set/unset the env var; you don't sed all scripts in /usr/bin. –  michael_n Feb 17 at 5:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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