--Boundary_(ID_4J4w7ohUWxWs9BJUbxzr4A)
Content-type: text/plain; charset=us-ascii; format=flowed
Content-transfer-encoding: 7BIT

Hi, all

There used to be a way of determining if firefox is running by checking 
the return value of:

$ firefox -remote "ping()"

However I tried it on 1.0 PR and it's gone. I googled for it and found a 
message that says the same thing so I guess it's not my problem. Anyway, 
I needed that, so I wrote a workaround that uses ps. The attached script 
is designed to open a page in firefox, but if firefox is already 
running, do it in a new tab.

I submit this for your enjoyment and critical review. I wonder if there 
is a better (or simply other) way to do it.

-- 
   "No, I do not contain myself,"
   were the final words from the set of self-excluding sets. :-)

--Boundary_(ID_4J4w7ohUWxWs9BJUbxzr4A)
Content-type: text/plain; name=catchthefox.sh
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=catchthefox.sh

#! /bin/bash

# catchthefox.sh
# By Yosef Meller
# License: GPL
#
# A script to launch a page in a new tab if firefox is running, 
# Otherwise run firefox and open the page.

FIREFOX=/usr/bin/firefox
HOST=localhost

# Different distros have different executable name, so grep -i
# For example, in Mandrake it's MozillaFirefox, in Gentoo it's just firefox.
ps -A | grep -i firefox > /dev/null

if [ $? -eq 0 ]
then
        $FIREFOX -remote "openURL(http://$HOST/lib/library.cgi,new-tab)" &
else
        $FIREFOX http://$HOST/lib/library.cgi &
fi


--Boundary_(ID_4J4w7ohUWxWs9BJUbxzr4A)--

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to