opengeometry-FFYn/CNdgSA at public.gmane.org
Fri Jul 30 19:53:08 UTC 2004
On Fri, Jul 30, 2004 at 02:40:43PM -0400, Gilles Fourchet wrote:
> Hi All,
> A couple of month ago, Jing published a script to run concurrent
> instances of Mozilla/Firefox. I am running Firefox 0.9.1 on Sarge and
> this script did not work well: it was able to start a new instance of
> Firefox only if one was already running.
> I found that it was because the mozilla-xremote-client version shipped
> with Firefox returned 0 to a successful ping (meaning if a client was
> already running).
> I tried to modified Jing's script to reflect that but, because I do not
> know Bash very well, my new script is not nice.
> Actually, in the script, the variable REMOTE is the program to be used
> for the ping. However, with this version of mozilla-xremote-client, you
> also have to specify what to ping with the option -a
> (mozilla-xremote-client -a firefox "ping()") knowing that you can ping
> Firefox, Thunderbird, Mozilla, or any.
> My problem is that I cannot put "mozilla-xremote-client -a firefox" in
> the REMOTE variable otherwise, when executed (`$REMOTE "ping()"`).
> Therefore, the only solution I found was to hard code the program with
> its path and options. Not good at all.
> Any trick?
> #REMOTE="/usr/lib/mozilla/mozilla-xremote-client -a firefox"
> if [ "$1" == "-remote" ]; then
> # calling program is smart enough to do it...
> exec $TARGET $*
> # `$REMOTE "ping ()"`
> `/usr/share/firefox_0.9.1/mozilla-xremote-client -a firefox "ping ()"`
/usr/share/firefox_0.9.1/mozilla-xremote-client -a firefox "ping ()"
REMOTE="/usr/lib/mozilla/mozilla-xremote-client -a firefox"
$REMOTE "ping ()"
Also, you don't need `...`
> if [ $? = 0 ] ; then
> echo "Already running ($?)"
> # there is already one running
> if [ -z "$1" ]; then
> exec $REMOTE "openURL("about:blank", new-window)"
> elif [ -f "$1" ]; then
> # okay, tedious work of trying to find the complete pathname
> # make two variables, trying to separate the path from file.
> file=`basename $1`
> if [ ! -d "$path" ]; then
> # try to fully expand the path
> path=`pwd $path`
'pwd' usually don't take argument. I don't think there is shell
wrapper for realpath(3).
> # okay, issue the command
> exec $REMOTE "openFile(file://$path/$file, new-tab)"
> # "new-tab" feature for URLs is broken in current firefox
> #exec $REMOTE "openURL($1, new-tab)"
> # so what we do instead is always open a new window and then
> # open the URL
> $REMOTE "xfeDoCommand(openBrowser)"
> exec $REMOTE "openURL($1)"
> # no mozilla currently running
> echo "Nothing running ($?)"
> exec $TARGET $* &
William Park, Open Geometry Consulting, <opengeometry-FFYn/CNdgSA at public.gmane.org>
Toronto, Ontario, Canada
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy