martes, 17 de febrero de 2015

Set the application to open magnet links on Google-Chrome

Motivation

As a Google-chrome user I wanted to know a way to set up the system to open the magnet links.
Firefox/Iceweasel users know that Firefox handles the default applications by itself, but Google-Chrome (and i think that Chromium) lies on xdg-open. So we need to tell xdg-open how to deal with magnet links

Finding your torrent application

To find your favorite torrent application you must go to 
/usr/share/applications/
And look for a file like 
your_favorite_torrent_app.desktop
In my case It was 
transmission-gtk.desktop
You must check that the file contains the following lines (for my case, transmission-gtk)

...
Exec=transmission-gtk %U
Icon=transmission
Terminal=false
TryExec=transmission-gtk
Type=Application
StartupNotify=true
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;GTK;
X-Ubuntu-Gettext-Domain=transmission
X-AppInstall-Keywords=torrent
Actions=Pause;Minimize;
...

The lines in bold are the important.

Configuring xdg-open

If everything is alright you can call xdg-mime command as root
# xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet
wich tells xdg-open that magnet links should be opened with transmission-gtk.

That's it, all you have to do is test that everything went ok by opening a fancy legal torrent magnet link.

References

No hay comentarios.:

Publicar un comentario