I know this is heavily cross posted, but it seemed like a important enough
thing.

For the not so tech savvy: this is how to tell your desktop environment to
launch Firefox when needed from another program, or if it's already
launched, to open a new tab with the requested URL.

Any other Linux users having problems with -remote, I came across a solution on the Firefox Bugs forum.

Before:

CODE
code:
firefox -remote 'ping()'
firefox -remote 'openURL(http://www.somethingawful.com/, new-tab)'



After:

CODE
code:
firefox -a firefox -remote 'ping()'
firefox -a firefox -remote 'openURL(http://www.somethingawful.com/, new-tab)'



In practice you would create a script like this and tell either KDE or
Gnome to use it as the default browser, I call mine .firefox.sh and put it
in my home directory.

this would work for Firefox 0.8 or earlier

#!/bin/sh
MOZILLA="/usr/bin/firefox"
if $MOZILLA -remote "ping()" 2>/dev/null
then
echo "Mozilla already launch"
location=",new-tab"
exec $MOZILLA -remote "openURL($1$location)"
else
exec $MOZILLA "$@"
fi
exit 1


For Firefox 0.9 you would use this

#!/bin/sh
MOZILLA="/usr/bin/firefox"
if $MOZILLA -a firefox -remote "ping()" 2>/dev/null
then
echo "Mozilla already launch"
location=",new-tab"
exec $MOZILLA -a firefox-remote "openURL($1$location)"
else
exec $MOZILLA "$@"
fi
exit 1


I hope this helps.