Daily Ubuntu / Linux news and application reviews.

ads

There are a lot of good BitTorrent applications for Linux, but some people just don't want to give up uTorrent because either they are too used to it or just because it actually works quite OK in Linux, under Wine. One major problem with using uTorrent this way is that Firefox doesn't open .torrent files with uTorrent, so you have to save the torrent file and then load it. This how-to will explain how to fix file associations for Linux to use uTorrent as the default system-wide BitTorrent client (well, I've only tested it on Firefox but should work on other browsers too). Let's begin:

1. Creating a new file to run uTorrent

Create a file, called utorrent.sh in your /home/<your_username>/bin/ folder with the following content:

#!/bin/sh

if [ "$1" ]; then
torrent_file="Z:`echo $1 | sed 's/\//\\\/g'`"
env WINEPREFIX="/home/<your_username>/.wine" wine \
"C:\\Program Files\\uTorrent\\uTorrent.exe" "$torrent_file"
else
env WINEPREFIX="/home/<your_username>/.wine" wine \
"C:\\Program Files\\uTorrent\\uTorrent.exe"
fi

Replace with the appropriate value... Obviously, you can create this file in any other place, just make sure you use the same path throughout all of the commands in this how-to.

Make this file executable by opening a terminal, navigate to /home/<your_username/bin/ and pasting the following command:
chmod +x utorrent.sh


2. Fixing the .desktop file

Open a terminal and paste this:
gksu gedit ~/.local/share/applications/wine/µTorrent.desktop

Don't change anything yet, just add this at the end of the file:
Categories=Network;FileTransfer;P2P
MimeType=application/x-bittorrent

In the same file, change the Exec line to this:
Exec=/home/<your_username>/bin/utorrent.sh %f

If you have created the file in some other location, replace the one above with the path to where you created the utorrent.sh file.

This is how the .desktop file should look after making the changes:

[Desktop Entry]
Name=µTorrent
Exec=/home/<your_username>/bin/utorrent.sh %f
Type=Application
StartupWMClass=Wine
Icon=6948_utorrent.0
Categories=Network;FileTransfer;P2P
MimeType=application/x-bittorrent


3. Making uTorrent the default BitTorrent client

Open a terminal and paste this:
gksu gedit ~/.local/share/applications/defaults.list

If the file is not empty, paste this at the end of the file:
application/x-bittorrent=µTorrent.desktop

If it's empty, paste this instead:
[Default Applications]
application/x-bittorrent=µTorrent.desktop


4. Update Gnome file associations:

Open a terminal and paste this:
update-desktop-database ~/.local/share/applications


That's it. Now when you open a .torrent file in Firefox, uTorrent will be the default application:

utorrent wine linux firefox

«
Next
Newer Post
»
Previous
Older Post
-->