Reply
Old June 18th, 2004 Top | #1
 
j79zlr's Avatar
Glaanies script monkey
Joined: February 2003
Location: Chicago
Posts: 2,725
Reputation: 1520
Power: 155

Default Open new tabs in firefox/mozilla

I know variations of this have been posted on the web, but I never found a working script, so I fixed it [for me atleast]. Create a script in your home directory named whatever you want [I use firefox_newtab.sh].

Code:
#!/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 by changing the browser to 'manual' and pointing it to the script, and in Thunderbird, by adding this to your prefs.js file:

user_pref("network.protocol-handler.app.http", "/path/to/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.
j79zlr is offline   Reply With Quote
Old June 18th, 2004 Top | #2

OSNN Folding Team  
vern's Avatar
Dominus
Joined: March 2002
Location: Minnesota, USA
Posts: 1,570
Reputation: 660
Power: 146

Default

Nice tip. Thanks!
vern is offline   Reply With Quote
Old June 18th, 2004 Top | #3

OSNN Folding Team  
gonaads's Avatar
Beware the G-Man
Joined: March 2002
Location: XP-erience, NTFS, OSNN, Bay Area, California
Posts: 18,474
Reputation: 4070
Power: 348

Default

You might want to post this info in this thread also.

http://www.osnn.net/forum/showthread.php?t=2466

"I play violent video games, I could snap at any second."
gonaads is offline   Reply With Quote
Old June 18th, 2004 Top | #4

OSNN Folding Team  
NetRyder's Avatar
Tech Junkie
Joined: April 2002
Location: New York City
Posts: 13,256
Reputation: 4260
Power: 298

Default

Very nice tip! Thanks
NetRyder is offline   Reply With Quote
Old June 18th, 2004 Top | #5
 
X-Istence's Avatar
*
Joined: December 2001
Location: USA
Posts: 6,496
Reputation: 2808
Power: 220

Default

Code:
#!/usr/local/bin/bash

export MOZILLA_FIVE_HOME=/usr/X11R6/lib/firefox/bin/:/usr/X11R6/lib/firefox/lib/mozilla-1.6/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MOZILLA_FIVE_HOME

# get URL to load
url=$1; [ -z $url ] && url=about:blank
what=$2;

if [ -z $what ]; then
        /usr/X11R6/lib/firefox/lib/firefox-0.9/mozilla-xremote-client -a firefox openURL\($url\,new-window\) && exit 0
else
        /usr/X11R6/lib/firefox/lib/firefox-0.9/mozilla-xremote-client -a firefox openURL\($url\,$what\) && exit 0
fi

# if xremote failed, then launch the browser
exec /usr/X11R6/lib/firefox/bin/firefox $url &
Given either:

firefox-starter <url> <type> (new-tab, or new-window)

If no URL or type is given, it starts a browser window with a blank screen (about:blank) if only URL is given, it opens a new browser window with that in it. If given new-tab it opens a new tab, and if new-window is set, a new-window (same as not defining it).

Enjoy .

(Sorry for the hardcoded stuff, change it as you deem fit, it is cause mozilla-xremote-client is not in the same place as firefox the startup script)
X-Istence is offline   Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
Your Top 5 Tabs Always Open Bman Green Room 8 May 31st, 2007 4:27am
Mozilla Firefox 1.0.5 released NetRyder Windows Desktop Systems 7 July 13th, 2005 5:14am
mozilla (firefox) ? mooo Green Room 12 April 5th, 2005 9:57pm
Mozilla Firefox 1.0.2 Final Lee Windows Desktop Systems 12 March 24th, 2005 2:00am
open in tabs bluzeboy Windows Desktop Systems 4 August 2nd, 2003 3:39am