#! /bin/bash
#
# if firefox is allready running, send it a command
# if started without arguments, open a new window, else a new tab
if pgrep -u `id -un` "firefox-bin" > /dev/null ; then
    if [ -z "$1" ]; then
	mozilla-firefox -remote "xfeDoCommand (openBrowser)"
    else
	mozilla-firefox -remote "openURL($1, new-tab)"
    fi
else
    mozilla-firefox $1
fi
