Torrent magnet links open new window but not transmission

59,754

Solution 1

If you want to use torrent to transmission, you have to allow remote access in transmission under preferences/remote.

If you want to open magnet links in transmission by clicking on them, you need to patch the /usr/bin/xdg-open script, here's mine for reference. The added lines are 311 and 490-493.

Solution 2

You can change the default handler for magnet links by editing the file .local/share/applications/mimeapps.list. Add the association to the two sections in the file like this (leaving other entries in those sections intact):

[Default Applications]
x-scheme-handler/magnet=transmission-gtk.desktop

[Added Associations]
x-scheme-handler/magnet=transmission-gtk.desktop

Log out and log back in for the change to take effect.

Solution 3

If you have installed transmission-gtk then the solution is easy.

gconftool-2 -s /desktop/gnome/url-handlers/magnet/command '/usr/bin/transmission-gtk %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/magnet/enabled --type Boolean true

The first one adds transmission-gtk as handler for magnet:// links the second enable it.

Since chrome/ium uses xdg-open this is the best method for setting the handlers. You can replace /usr/bin/transmission-gtk for any client you like. This works for almost all flavors of Ubuntu.

You can test this issuing in the terminal xdg-open "magnet:?xt=urn:btih:f41989f9797a88505f9e258d5e5d1354c3731a99" (downloads Ubuntu 13.04 64-bit)


Other solution is using xdg-mime:

xdg-mime default transmission-gtk.desktop application/x-bittorrent
xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet

In case you don't have the mime-types installed use xdg-mime install x-scheme-handler/magnet.

Share:
59,754

Related videos on Youtube

Quinn Culver
Author by

Quinn Culver

Updated on September 18, 2022

Comments

  • Quinn Culver
    Quinn Culver almost 2 years

    I've installed Ubuntu and Lubuntu a few times now and some of those times I've had the following problem, which I currently have. When I click a torrent magnet link in Chrome (usually from Pirate bay), instead of opening transmission, the only thing that happens is a new Chrome window opens.

    Upon other installations, I've not had this problem; transmission opened just as I'd like.

    I've tried using Chrome's extension .torrent to Transmission, but I get the error

    unable to contact http ://localhost:9091/transmission/rpc

    no response

    • Admin
      Admin almost 11 years
      Note: I'm using Lubuntu 13.04.
    • Admin
      Admin almost 11 years
      Note: Firefox correctly handles magnet links.
    • Admin
      Admin almost 11 years
      @BiggJJ I tried following Chan-Ho Suh's solution there, but to no avail.
    • Admin
      Admin almost 11 years
      What version of Google chrome are you running? I use Google Chrome 28.0.1500.71 and it correctly handles magnet links withot to do nothing.
    • Admin
      Admin almost 11 years
      You are trying to open a magnet:// link, or downloading a proper .torrent file?
    • Admin
      Admin almost 11 years
      @Braiam A magnet.
    • Admin
      Admin almost 11 years
      just press right click in magnet link and copy it after that go to transsmion program and but it on it
    • Admin
      Admin almost 11 years
      @Mahmoud20070 That works, thanks. But it's still sub-optimal since I'd prefer to just be able to click in Chrome and have Transmission opened automatically with the torrent.
    • Admin
      Admin almost 11 years
      Can you post cat /usr/share/app-install/desktop/chrome.desktop | grep MimeType and cat /usr/share/application/chrome.desktop | grep MimeType?
    • Admin
      Admin almost 11 years
      cat: /usr/share/app-install/desktop/chrome.desktop: No such file or directory and cat: /usr/share/application/chrome.desktop: No such file or directory
    • Admin
      Admin almost 11 years
      Ok, lets try to start clean, uninstall all transmission packages apt-get purge transmission* and install just transmission-gtk. I've tested again and I just don't see where things went wire.
    • Admin
      Admin almost 11 years
      @Braiam I re-installed transmission (per your suggestion) but am still having the same problem.
    • Admin
      Admin about 9 years
      This happened to me (on Ubuntu 14.04.2 LTS) when Chromium was set as my default browser. If Firefox was set as my default browser, then Chromium instead started up a new empty tab in Firefox.
  • j0h
    j0h almost 11 years
    omgchrome.com/install-google-chrome-in-ubuntu-13-10 This claims there is a dependency issues.
  • j0h
    j0h almost 11 years
  • Quinn Culver
    Quinn Culver almost 11 years
    I tried this but I hasn't seemed to work. Still chrome just opens a new browser (or a new tab separate from the others; however you wanna put it).
  • Braiam
    Braiam almost 11 years
    There's no transmission.desktop in transmission's source file. Check if you meant transmission-gtk.desktop.
  • Quinn Culver
    Quinn Culver almost 11 years
    This doesn't seem to have worked. Still, even when I try your test from the terminal (to download Ubuntu), it opens a new Chrome window.
  • Quinn Culver
    Quinn Culver almost 11 years
    I tried this. It didn't seem to work.
  • Quinn Culver
    Quinn Culver almost 11 years
    @Braiam Yes, I tried with and without the -gtk.
  • Braiam
    Braiam almost 11 years
    @QuinnCulver What's the output of gconftool-2 -g /desktop/gnome/url-handlers/magnet/command?
  • Braiam
    Braiam almost 11 years
    @QuinnCulver and gconftool-2 -g /desktop/gnome/url-handlers/magnet/enabled? Try logging out to force the values to be updated.
  • Quinn Culver
    Quinn Culver almost 11 years
    The output is: true. I'd rebooted last time I tried your suggested commands. I'll try again; this time I'll only log out.
  • Braiam
    Braiam almost 11 years
    @QuinnCulver I updated my responce with yet another solution.
  • Akisame
    Akisame over 10 years
    You actually have to add the bittorrent entry to the xdg-open list to make this work with chrome as far as I know. Also bittorrent is a name for the system so almost all bittorrent clients have the word bittorrent in it's name.
  • zrajm
    zrajm about 9 years
    That was not exactly the solution I was looking for (I don't like having to patch my OS stuff, even if it's just a silly wrapper script). But it worked perfectly. (I'm on Ubuntu 14.04.2 LTS with Chromium set as my default browser.)
  • Umar
    Umar about 9 years
    can i copy and repaste the whole thing again on lubuntu 14.04 lts.
  • tpv
    tpv about 9 years
    @john : I'm on 14.04 too, using the same script, it should work :) (but please make a backup just in case)
  • Gabriel Felvinczi
    Gabriel Felvinczi over 8 years
    the gist link is a 404
  • tpv
    tpv over 8 years
    @m0sa : should be fixed now