22

The key /desktop/gnome/url-handlers/magnet in gconf-editor is missing.

How do I assign magnet links to use qbittorrent?

It would be really nice if it were easy to set url handlers. I always struggle with this when doing a fresh install. I would like to set subl:// to open sublime text 2 too.

EDIT: I would like it to work regardless of the application I'm using to activate the link. I'm using Chrome, but IMO the OS (Ubuntu) should be handling links that an application doesn't know how to handle - which it does, so how would one configure this?

EDIT2: This post details how to make the text editor in VIM handle vim:// urls, perhaps this can be applied to to magnet links. i.e create a desktop shortcut defining a MimeType handler then refreshing the cache. (Can't try right now as I'm using 12.04). http://www.tkalin.com/blog_posts/using-console-vim-as-vim-protocol-handler-in-ubuntu

4 Answers4

44

I had the same problem and managed to fix it by setting the defaults for both gvfs as well as xdg.

check defaults with:

xdg-mime query default x-scheme-handler/magnet
gvfs-mime --query x-scheme-handler/magnet

and set them with

xdg-mime default qbittorent.desktop x-scheme-handler/magnet
gvfs-mime --set x-scheme-handler/magnet qbittorrent.desktop

Assuming you have a qbittorrent.desktop file at /usr/share/applications/

guntbert
  • 13,134
nicja
  • 575
  • 5
  • 6
  • Thanks for your answer, think this is what I was looking for a year ago so I'm marking it as the answer. qBittorrent (tested v13.08) now seems to have MimeType=application/x-bittorrent;x-scheme-handler/magnet; already in the desktop file so, for me, I haven't had to do anything special with a fresh Ubuntu install. – Stan Bondi Jul 18 '14 at 11:15
  • Thank you. One note though. In Xubuntu 17.10 running Chrome, the above did not work. Setting dxg-mime did nothing. Setting gvfs-mime returned the message "This tool has been deprecated, use 'gio mime' instead". So, using gio instead, i.e., running "gio mime x-scheme-handler/magnet qBittorrent.desktop" fixed the issue. – Sumac Nov 22 '17 at 07:45
  • exitxdg-mime: command not found – roottraveller Sep 13 '18 at 08:09
  • What if I don't have a qbittorrent.desktop file at /usr/share/applications/? How do I create one? Also, when I do gvfs-mime --query x-scheme-handler/magnet I get a This tool has been deprecated, use 'gio mime' instead. notice and then a gio: Unknown option --query error... – neubert Mar 02 '20 at 22:58
  • 1
    I tried setting qbittorrent.desktop with contents from https://raw.githubusercontent.com/qbittorrent/qBittorrent/master/dist/unix/org.qbittorrent.qBittorrent.desktop . I also found out that you can query with gio mime by doing gio mime x-scheme-handler/magnet and you can set the handler by doing gio mime x-scheme-handler/magnet org.qbittorrent.qBittorrent.desktop. Altho despite that it's still trying to load with the Transmission bittorrent client... – neubert Mar 02 '20 at 23:27
  • If anyone can't find qbittorrent.desktop: I didn't have qbittorrent.desktop at /usr/share/applications but I ran the command anyway. It ended up automatically finding that it should be org.qbittorrent.qBittorrent.desktop – JolonB Jul 03 '21 at 22:36
5

Probably not the best way, but I achieved this simply by uninstalling Transmission - which caused the default to switch to qBittorrent automatically.

To remove Transmission:

sudo apt purge transmission\*
Eliah Kagan
  • 117,780
  • 1
    Probably the best answer here. :D By the way if you install 'deluge' torrent client - from the options in the program you can set the default program to be deluge for your torrents/magnet links. – Combine Oct 26 '18 at 15:53
3

If you have installed q bittorrent for the first time when you click a magnetic link it will ask you to launch an application. So you need to select q bittorrent.

on the left hand side you would see filesystem. select that. /usr/bin/ ...search for q bittorrent in that list. then click OK. The download should start automatically.

jerin
  • 53
  • 8
2

If you are using Firefox for your web browser. Goto Edit > Preferences > Applications tab Then type magnet in the search box. The select qbitorrent as your default application. If it isn't in the list select Use Other and then locate the qbitorrent program.

There is a Extension for Chrome/Chromium call Remote Torrent Adder that supports qbitorrent. It adds the torrents through it's WebUI qbitorrent will have to already be running for it to work. Hope this helps.

To assign qbitorrent as the default .torrent files right click on a downloaded file, select properties, and the open with tab. Then select qbitorrent as the default application to open torrent files. Reference for 4 different ways to select default applications is over at howtogeek.com

Garry
  • 199
  • 1
  • 5
  • Thanks for your answer. I'm using Chrome. I suppose it's a nice feature of firefox to have configuration for url handling, but I know that ubuntu can (and IMO should) handle this too - would like to know how to configure this. – Stan Bondi Jun 14 '13 at 13:14
  • I just looked through the extension for Chrome/Chromium there are quite a few, the Remote Torrent Adder looks most promising. – Garry Jun 20 '13 at 01:25
  • Thanks Garry, I'll mark this as the answer because it seems like a helpful work around. In ubuntu 12.04 I was able to set magnet links to use qBitTorrent 'natively', but not in 13.04. Still can't find a way to set arbitrary url handlers - I know there is a way to do this on mac. – Stan Bondi Jun 20 '13 at 06:46