Click to See Complete Forum and Search --> : Open new tabs in firefox with apps


j79zlr
06-17-2004, 11:38 PM
I know this has been posted on the web, but I never found a working script, well I fixed it [for me atleast]. Create a script in your home directory named whatever you want [I use firefox_newtab.sh.

#!/bin/sh
export MOZILLA_FIVE_HOME="/usr/lib/mozilla-firefox"

url="$1"
if [ "x$url" = "x" ]; then
url="about:blank"
fi

if $MOZILLA_FIVE_HOME/mozilla-xremote-client -a firefox openURL\("$url",new-tab\); then
exit 0
fi
exec $MOZILLA_FIVE_HOME/firefox "$url"

Now if you point an application to use that instead of the binary it will open in a new tab instead of the "Choose Profile" dialog. Works in GAIM and in Thunderbird, by adding this to your prefs.js file:

user_pref("network.protocol-handler.app.http", "/home/joe/firefox_newtab.sh");

I am assuming that this works for mozilla in the exact same manner, by changing the FIVE_HOME path to mozilla's and the line to mozilla-xremote-client -a mozilla openURL etc; also, I would assume that you could remove the /usr/bin/mozilla binary and replace it with the shell script, and not need to point to the script then.

canon006
06-18-2004, 12:43 AM
I posted this one in a thread yesterday, this is what I use, if you replace "new-window" with "new-tab" (no quotes of course) it'll open in new tabs instead of windows.

#!/bin/bash
FIREFOX_PATH="/usr/local/firefox"
$FIREFOX_PATH/firefox -a firefox -remote "openURL($@, new-window)" || exec $FIREFOX_PATH/firefox "$@";

I think you're right about being able to replace the Mozilla binary with a script and it would work. What confuses me is, why do we need to do this in the first place? Mozilla works as you would expect, or is it just that the system already sends urls and such to Mozilla that way?


Looks like I've answered my own question with not even a minute of exploration, /usr/bin/mozilla is actually just a script that does what these few scripts do, if you replace that script with one of these for firefox, it works perfectly. Wonderful!

sharth
06-18-2004, 12:44 AM
I know debian does this (and I'd expect atleast gentoo to do this as well)

But instead of having /usr/bin/mozilla be the binary, its a script that decides that if mozilla is already running, to run a new window of mozilla rather than a new version (and get the profile window).

It does all sorts of spiffy stuff to.