Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-16-2008, 01:20 AM   #1
LQ Newbie
Registered: Jan 2005
Posts: 25

Rep: Reputation: 15
bash alltray wine utorrent

I found a nifty script online using google that would launch wine utorrent paramater IF a parameter was passed to the bash script
otherwise it would just launch utorrent w/o the parameter. Well, for some odd reason the System Tray Icon for utorrent stopped displaying properly in xfce4 for me so I found a program called alltray.
if you've installed alltray and have done alltray --help then you know the following is how you use alltray

usage: alltray [options] ["] <program_name> [program parameter] ["]

so I changed the script a bit, the old script had

wine /path/to/utorrent.exe "$var"
wine /path/to/utorrent.exe &

this worked great, but like I said, fubar'd sys tray requires me to use alltray now.

the problem, I THINK, is my double quotes. the value of $var is not being passed correctly to utorrent. utorrent complains the /path/to/the/dot/torrent/file is not found. and utorrent displays it like so: Z:tmpNAME_OF_TORRENT.torrent

I think it should look like Z:tmp\name_of_torrent.torrent or Z:\tmp\name_of_torrent.torrent

the thing that is weird is I never changed the sed line, if it was parsing it properly before I don't see why it isn't now.

additional information: in winecfg Z: is set to /

so, where have I gone wrong in the following script?


if [ "$1" != "" ]; then
var="`echo $1 | sed 's/\//\\\/g'`"
alltray --icon /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.png "wine /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.exe "$var""
alltray --icon /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.png "wine /home/<user name>/.wine/drive_c/Program\ Files/uTorrent/uTorrent.exe &"
Old 05-17-2008, 03:36 AM   #2
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
May I ask for, why don't you use native torrent engines such as Azureus?

you wouldn't need wine to run that
Old 06-27-2008, 11:38 PM   #3
LQ Newbie
Registered: May 2004
Location: Charlotte, N.C.
Posts: 21

Rep: Reputation: 0
Playing with Scripts

This works (can be put in a file /usr/bin/uTorrent with sudo)
cd ~/".wine/drive_c/Program Files/uTorrent/"
if [ "$1" != "" ]; then
var="`echo $1`"
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe" "$var"
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe"
This one also worked for me:
(putting this in a file /usr/bin/uTorrent with sudo)
cd ~/".wine/drive_c/Program Files/uTorrent/"
if [ "$1" != "" ]; then
var="`echo $1 | sed 's%/%\/%g'`"
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe" "$var"
wine ~/".wine/drive_c/Program Files/uTorrent/uTorrent.exe"
'l' is my '/', change var="l:${var}" or wine, so that '/' and it's drive letter match the letter here, as well as match the paths to uTorrent, etc...
The above code worked for me, while the codes I found for this on the internet didn't
These only work for passing 0 or 1 torrents to uTorrent
Wine will work in both formats(Windows, and Linux) for paths, so the conversion work part from above isn't necessary (and may reduce flexibility?)
the cd ~/".wine/drive_c/Program Files/uTorrent/" is also optional
On my computer uTorrent has a tray icon without doing anything special
Test your scripts by playing around with something like:
if [ "$1" != "" ]; then
var="`echo $1 | sed 's%/%\/%g'`"
echo $var
messing with the var= part, until it echoes what you want
KUbuntu 8.04_x64, Wine 1.0, uTorrent 1.7.7

Last edited by BryanFRitt; 06-28-2008 at 11:40 AM. Reason: clarity, minor editing


bash, script, shell, slash, utorrent, wine

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
alltray jahanzeb1982 Linux - Software 1 03-22-2008 08:29 PM
uTorrent: For "Wine" and Windows! How do you feel about it? Mega Man X General 4 02-06-2008 02:55 PM
Utorrent RSS Does't work! (WINE) TruANTOlogy Linux - Software 2 07-25-2006 09:19 PM
wine utorrent.exe fault Linux - Software 9 05-03-2006 02:48 PM
AllTray Trouble thecrazydood Linux - Software 0 09-21-2005 09:02 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:47 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration