Jing Su jingsu-26n5VD7DAF2Tm46uYYfjYg at
Mon Jul 5 19:23:57 UTC 2004

First, my apologies for not posting as a thread reply to this topic; I
lost the original thread of messages about this.

For those that are interested, here is a fixed version of that browser
launching script I sent out before (it's an attachment).  I use the
mozilla-xremote-client executable that others have pointed out.  It seems
that though the "-remote" command from the primary executable is broken,
the xremote-client executable is able to communicate ok with the running

What's nice about the script is that you can just keep calling it without
worrying about running instances and stuff.  So, you can do: thisfile.html
or /var/www/html/index.html

and it will do the "right thing", regardless of whether or not mozilla (or
firefox) is currently running.  One caveat is that apparently the
'new-tab' and 'new-window' flags for URLs is still broken, even through
the xremote-client program.  So, URL opens always opens a new window and
then opens the URL in the new window, via a workaround.  It's commented in
the script, so you can play around with it.

Anyways, you'll have to edit the script and change the TARGET and REMOTE
variables to point to the right mozilla or firefox programs.

On my system, I have copied into /usr/local/bin and made
executable.  I then make /usr/local/bin/mozilla a symlink to this script,
so that programs that call 'mozilla' will automatically go through this
script.  Tailor to your personal taste. :)

Any comments or suggestions welcome.
I hope some of you will find it useful.

-------------- next part --------------


if [ "$1" == "-remote" ]; then
    # calling program is smart enough to do it...
    exec $TARGET $*

elif `$REMOTE "ping()" &> /dev/null`; then
    # 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`
        # 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
    exec $TARGET $* &

More information about the Legacy mailing list