Page 1 of 1

Problem with magnet links in Ubuntu Natty

Posted: Mon May 09, 2011 6:38 pm
by 666
Hello i have a problem in Ubuntu Natty associating magnet links with Deluge. If i associate magnet links with some other client it works well, but when i try with Deluge they keep opening with the previous program i had associated.
In gconf-editor i saw that when i associate magnet links with the (others - associate magnet links with deluge) menu, the command it uses is deluge '%s', i tried changing it to deluge-gtk '%s' and doesn't work either.

If i type in a console deluge + some magnet link it opens with deluge without problem.

Someone have any idea in how to fix the problem?

I posted this problem in support but i think this comes here.

Re: Problem with magnet links in Ubuntu Natty

Posted: Thu May 12, 2011 11:52 pm
by Cas
Are you sure its not a problem with xdg-open as reported here: http://ubuntuforums.org/showthread.php?t=1747876

I have tried it with Firefox 4 magnet handler and works ok.

Re: Problem with magnet links in Ubuntu Natty

Posted: Sat May 28, 2011 12:04 pm
by 666
I don't know what the problem is, but it only happens with Deluge.

Re: Problem with magnet links in Ubuntu Natty

Posted: Sat May 28, 2011 4:13 pm
by jodon
<re-post of my reply from the support forum>

Currently Ubuntu has a bug in the Deluge packaging.

You already found the keys in gconf-editor that are set to associate deluge with magnet links, but those keys only affect the behaviour of xdg-open.
As of Natty, it appears that the file-open functionality is instead handled by gvfs-open. To test, You can invoke gvfs-open directly on the command line and give it a magnet link as an argument.

gvfs-open doesn't use the gconf stuff, instead it examines the .desktop files bundled with each application to determine what file types can be handled.

The /usr/share/applications/deluge.desktop file has two separate problems in it, both of which must be fixed for deluge to start handling magnet links from your web browser.

The current "official" version of the file:

Code: Select all

Version=1.0
Name=Deluge BitTorrent Client
GenericName=Bittorrent Client
Comment=Transfer files using the Bittorrent protocol
Exec=deluge-gtk
Icon=deluge
Terminal=false
Type=Application
Categories=Network;
StartupNotify=true
MimeType=application/x-bittorrent;
First problem:

Code: Select all

Exec=deluge-gtk
This line should have "%U" added to the end, this string gets replaced with the url/filename for deluge to open when invoked.

Second problem:

Code: Select all

MimeType=application/x-bittorrent;
This does not specify that deluge is capable of handling magnet links.

Corrected version:

Code: Select all

Version=1.0
Name=Deluge BitTorrent Client
GenericName=Bittorrent Client
Comment=Transfer files using the Bittorrent protocol
Exec=deluge-gtk %U
Icon=deluge
Terminal=false
Type=Application
Categories=Network;
StartupNotify=true
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
If you are changing this by hand, then you need to run "update-desktop-database" after saving the corrected version of the file.

There is no bug for this in launchpad currently, I tried to create one this morning but couldn't figure out how. :oops:

Re: Problem with magnet links in Ubuntu Natty

Posted: Sat May 28, 2011 4:39 pm
by Cas
We have actually updated the Desktop file for 1.3.2 and will be in PPA soon.

deluge.desktop

Re: Problem with magnet links in Ubuntu Natty

Posted: Wed Sep 28, 2011 7:34 pm
by ChaosR
For me, adding the following line to ~/.local/share/applications/mimeapps.list was also needed to get deluge running magnet links, instead of transmission:

Code: Select all

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