Firefox as your default browser

I am trying to make the switch to firefox from galeon because of an extension I can’t live without, and I was having trouble when I set firefox as my default browser. When I opened links from other applications, they weren’t popping up in new tabs despite the preferences I set. So, I wrote a little script to correct the behavior:

firefox --remote "ping()"
if [ $? = 0 ] ; then
	firefox --remote openURL\("$1",new-tab\)
else
	firefox $1
fi

I saved this as firefox.sh, and set my default browser to firefox.sh

(Note, I am not using Tabbed Browser Extensions because it’s buggy, bloated, and holy fuck does it have too many options.)