One of the applications I couldn’t let go of when I switched from Windows to Ubuntu was uTorrent. Unfortunately, as you need to run uTorrent using Wine, there is no direct way to automatically launch uTorrent when you click a .torrent link in your browser. Up until now I had a workaround – I created a separate folder in which I saved the torrent files and told uTorrent to watch it for any new files. It works great, and the torrents appear pretty much instantly in the download list. This obviously only works as long the app is running in the first place.

Now I just came across this post on the Ubuntu forums. All you need is a small script which you get Firefox (or any other browser you’re using) to launch when a .torrent link is clicked. Do the following:

From the terminal create a new file for the script:

sudo gedit /usr/bin/utorrent

Now paste the following into it:

#!/bin/sh
cd ~/.wine/drive_c/Program\ Files/utorrent
if [ "$1" != "" ]; then
var="`echo $1 | sed 's/\//\\\/g'`"
var="Z:${var}"
wine utorrent.exe "$var"
else
wine utorrent.exe
fi

Make sure the path to the uTorrent folder is correct, then save.

Set the file permissions:

sudo chmod a+x /usr/bin/utorrent

(Update: if you are having problems with the above script then try Adam’s solution down in the comments)

All you need now is to open your browser’s Preferences and tell it to launch your new script when you click a torrent file. Works like a charm.


Possibly related posts:

  1. Sending/receiving files via bluetooth in Ubuntu
  2. Bypass the Deleted Items folder in Nautilus
  3. Wheel-click drag and drop in Ubuntu
  4. Organise your music collection with EasyTAG
  5. Enable S-video on ATI cards