| |
|
Scripts for Firefox
To start, run a splash screen, or close cleanly if frozen.
First, I use a couple scripts to start Firefox. The first is pretty
common except that it fires up a splash screen if Firefox was not open yet.
Normally I'm not a fan of slashscreen fanfare, but Firefox does take several
seconds to load, and I use Sylpheed for mail. So when I open links I'd kind of
like to know if I might NOT have properly double-clicked on a link in my email, without sitting there
waiting for nothing . . . (You Sylpheed users know what I'm talking about.)
And some folks just like splasscreens. So here goes --
You need Firefox, XV and an image to use for a splash.
[You probably have xv already, type "which xv" in an xterm if unsure.]
That and the two small scripts below. "firefox.sh" and "ffsplash.sh"
Don't forget to make then executable.
I also symlink firefox.sh to "mozilla" -- that saves a lot of effort down the road.
firefox.sh
#!/bin/sh
# Written by Robert Mullenix, June 2004
# reworked and personalized by Paul Sherman
# currently running with firefox-1.0.2
# also connect it to another script which runs a splash screen
# which I find especially useful when calling Firefox from Sylpheed.
MOZILLA="/usr/bin/firefox"
home="http://www.google.com"
# first, correct the path if one is passed
if [ "$1" != "" ]
then
if [ "`expr substr "$1" 1 1`" = "/" ]
then
FILE_PATH="file://$1"
else
FILE_PATH="$1"
fi
fi
FILE_PATH=${FILE_PATH//" "/"%20"}
# Find out Firefox is open already
if $MOZILLA -a firefox -remote "ping()" 2>/dev/null
then
if [ -z $1 ]
then
# instance already opened, no url passed, open new tab
$MOZILLA -a firefox -remote "openURL($home,new-tab)" &
else
# instance already opened, launch URL $1 in new tab
$MOZILLA -a firefox -remote "openURL($FILE_PATH,new-tab)" &
fi
else
ffSplash.sh &
if [ -z $1 ]
then
# no URL present, just open firefox
$MOZILLA &
else
# no instances exist, open a new window with URL $1
$MOZILLA $1 &
fi
fi
exit 1
|