Every time I download a torrent file (
.torrent), Firefox thinks I should open it with a text editor. How can I get it to open with Transmission? In Edit -> Preferences -> Applications, there's no setting for torrent files, and no apparent way to add a new filetype.
Method (I): Using Firefox's Preferences menu: (preferred)
A. From Firefox's global menu, select Edit -> Preferences (or press Alt + E followed by N) to open Firefox Preferences.
(Snapshot taken in Ubuntu 12.04)
B. Select the Applications menu and search for BitTorrent seed file or application/x-bittorrent or torrent. Change the Always ask or Use gedit (default) to transmission-gtk by selecting Use other... and click File System in the side bar, then browse to
D. That's it! Now the .torrent files will be opened with transmission.
Method (2): Editing the mimeTypes.rdf file:
Open the mimeTypes.rdf file with text editor of your choice:
(Save a backup of this file.) Search for the container:
and insert this:
so that, now the container looks something like this:
(step 1 snapshot)
Now, within the container:
so that the container will look something like this:
(step 2 snapshot)
Save and close the file. Then restart firefox.
Another more user-friendly way to add a new file type to the Edit -> Preferences -> Applications window is by downloading a file that has the file format you want to add, selecting any option, and selecting the "Do this automatically for files like this from now on." checkbox. Source: firefox doc.
Next time you download a torrent file, and the window pops up to ask what to do, give the path for the file to open with:
The answer depends on whether the server sends you the correct mime type (not just the file with the right extension). You can check whether the server is sending the correct mime type by installing the Live HTTP Headers addon for Firefox. (Start the addon just before you click on the download link for the torrent file, and watch the response header, it should contain: Content-Type: application/x-bittorrent.) If it does, then Firefox will be able to open the file with the default application currently setup on your computer. In Ubuntu you can download a torrent file, then right click and select 'Properties', there you will find a way to select the default application.
If, however, the server sends .torrent as an octet-stream or some other weird mime, then Firefox will NOT do the stupid thing and open it by extension (like some broken browsers do), since that can lead to very bad results. But every so often you are willing to take a risk, you can try https://addons.mozilla.org/en-US/firefox/addon/force-content-type/, but keep in mind that this extension is considered buggy and may actually make the matters worse.
If the server is doing it wrongly, and you are not willing to take risks, you can simply have Transmission monitor your download folder and automatically add torrent files you place there. It can even remove the files after it added them. You will find that in the settings of Transmission.
P.S. Should you need a way to keep other application as the default when double clicking, but transmission only from firefox, you can follow instructions at http://forums.mozillazine.org/viewtopic.php?f=9&t=1706945