2 # based on script by (c) vip at linux.pl, wolf at pld-linux.org
4 if [ `arch` == "x86_64" ]; then
5 LIBDIR="/usr/lib64/mozilla-firefox"
7 LIBDIR="/usr/lib/mozilla-firefox"
10 MOZILLA_FIVE_HOME=$LIBDIR
12 MOZLOCALE="$(/usr/bin/locale | grep "^LC_MESSAGES=" | \
13 sed -e "s|LC_MESSAGES=||g" -e "s|\"||g" )"
14 for MOZLANG in $(echo $LANGUAGE | tr ":" " ") $MOZLOCALE; do
15 eval MOZLANG="$(echo $MOZLANG | sed -e "s|_\([^.]*\).*|-\1|g")"
17 if [ -f $MOZILLA_FIVE_HOME/chrome/$MOZLANG.jar ]; then
18 MOZARGS="-UILocale $MOZLANG"
23 if [ -z "$MOZARGS" ]; then
25 for MOZLANG in $(echo $LANGUAGE | tr ":" " ") $MOZLOCALE; do
26 eval MOZLANG="$(echo $MOZLANG | sed -e "s|_.*||g")"
28 LANGFILE=$(echo ${MOZILLA_FIVE_HOME}/chrome/${MOZLANG}*.jar \
30 if [ -f "$LANGFILE" ]; then
31 MOZLANG=$(basename "$LANGFILE" | sed 's/\.jar//')
32 MOZARGS="-UILocale $MOZLANG"
38 # compreg.dat and/or chrome.rdf will screw things up if it's from an
39 # older version. http://bugs.gentoo.org/show_bug.cgi?id=63999
40 for f in ~/{.,.mozilla/}firefox/*/{compreg.dat,chrome.rdf,XUL.mfasl}; do
41 if [[ -f ${f} && ${f} -ot /usr/bin/mozilla-firefox ]]; then
42 echo "Removing ${f} leftover from older firefox"
47 if [ -n "$MOZARGS" ]; then
48 FIREFOX="$LIBDIR/firefox $MOZARGS"
50 FIREFOX="$LIBDIR/firefox"
53 if [ "$1" == "-remote" ]; then
56 PING=`$FIREFOX -remote 'ping()' 2>&1 >/dev/null`
57 if [ -n "$PING" ]; then
58 if [ -f "`pwd`/$1" ]; then
59 exec $FIREFOX "file://`pwd`/$1"
65 exec $FIREFOX -remote 'xfeDoCommand (openBrowser)'
66 elif [ "$1" == "-mail" ]; then
67 exec $FIREFOX -remote 'xfeDoCommand (openInbox)'
68 elif [ "$1" == "-compose" ]; then
69 exec $FIREFOX -remote 'xfeDoCommand (composeMessage)'
71 if [ -f "`pwd`/$1" ]; then
76 grep browser.tabs.opentabfor.middleclick ~/.mozilla/firefox/*/prefs.js | grep true > /dev/null
78 exec $FIREFOX -remote "OpenUrl($URL,new-tab)"
80 exec $FIREFOX -remote "OpenUrl($URL,new-window)"