|
发表于 2004-8-17 11:35:55
|
显示全部楼层
修改后的 firefox脚本,可以用new-tab打开了: (我的是firefox0.9)
[code:1]
#!/bin/sh
#
### Modified by mozaiti@smth
#
### Why modified?
### Disable the bothering select user profile.
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
cmdname=`basename $0`
## don't leave any core files around
ulimit -c 0
##
## Variables
##
MOZ_DIST_BIN="/usr/lib/firefox"
MOZ_PROGRAM="/usr/lib/firefox/firefox-bin"
MOZ_CLIENT_PROGRAM="/usr/lib/firefox/mozilla-xremote-client"
##
## Set MOZILLA_FIVE_HOME
##
MOZILLA_FIVE_HOME="/usr/lib/firefox"
export MOZILLA_FIVE_HOME
LD_LIBRARY_PATH=/usr/lib/firefox:/usr/lib/firefox/plugins:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:/usr/lib/firefox/plugins:/usr/lib/firefox/plugins
export MOZ_PLUGIN_PATH
##
## Set FONTCONFIG_PATH for Xft/fontconfig
##
FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
export FONTCONFIG_PATH
function check_running() {
$MOZ_CLIENT_PROGRAM 'ping()' 2>/dev/null >/dev/null
RETURN_VAL=$?
if [ "$RETURN_VAL" -eq "2" ]; then
echo 0
return 0
else
echo 1
return 1
fi
}
function open_mail() {
if [ "${ALREADY_RUNNING}" -eq "1" ]; then
exec $MOZ_CLIENT_PROGRAM 'xfeDoCommand(openInbox)' \
2>/dev/null >/dev/null
else
exec $MOZ_PROGRAM $*
fi
}
function open_compose() {
if [ "${ALREADY_RUNNING}" -eq "1" ]; then
exec $MOZ_CLIENT_PROGRAM 'xfeDoCommand(composeMessage)' \
2>/dev/null >/dev/null
else
exec $MOZ_PROGRAM $*
fi
}
# OK, here's where all the real work gets done
# check to see if there's an already running instance or not
ALREADY_RUNNING=`check_running`
# If there is no command line argument at all then try to open a new
# window in an already running instance.
if [ "${ALREADY_RUNNING}" -eq "1" ] && [ -z "$1" ]; then
exec $MOZ_CLIENT_PROGRAM "xfeDoCommand(openBrowser)" 2>/dev/null >/dev/null
fi
# check system locale
MOZARGS=
MOZLOCALE=`echo $LANG | sed "s|_\([^.]*\).*|-\1|g"`
[ -f $MOZILLA_FIVE_HOME/chrome/$MOZLOCALE.jar ] && MOZARGS="-UILocale $MOZLOCALE"
# if there's no command line argument and there's not a running
# instance then just fire up a new copy of the browser
if [ -z "$1" ]; then
exec $MOZ_PROGRAM $MOZARGS 2>/dev/null >/dev/null
fi
unset RETURN_VAL
# If there's a command line argument but it doesn't begin with a -
# it's probably a url. Try to send it to a running instance.
USE_EXIST=0
opt="$1"
case "$opt" in
-mail)
open_mail ${1+"$@"}
;;
-compose)
open_compose ${1+"$@"}
;;
-*) ;;
*) USE_EXIST=1 ;;
esac
if [ "${USE_EXIST}" -eq "1" ] && [ "${ALREADY_RUNNING}" -eq "1" ]; then
# check to make sure that the command contains at least a :/ in it.
echo $opt | grep -e ':/' 2>/dev/null > /dev/null
RETURN_VAL=$?
if [ "$RETURN_VAL" -eq "1" ]; then
# if it doesn't begin with a '/' and it exists when the pwd is
# prepended to it then append the full path
echo $opt | grep -e '^/' 2>/dev/null > /dev/null
if [ "${RETURN_VAL}" -ne "0" ] && [ -e `pwd`/$opt ]; then
opt="`pwd`/$opt"
fi
exec $MOZ_CLIENT_PROGRAM "openurl($opt,new-tab)" 2>/dev/null >/dev/null
fi
# just pass it off if it looks like a url
exec $MOZ_CLIENT_PROGRAM "openurl($opt,new-tab)" 2>/dev/null >/dev/null
fi
exec $MOZ_PROGRAM $MOZARGS ${1+"$@"}
[/code:1] |
|