#!/bin/sh # version 0.1 # author: Marcel Meckel, http://www.adminblogger.de/ # # Script tries to open URLs in an already running # Firefox window. If no running window is found # a new Firefox process is being started. # # I wrote this script because on OpenSUSE 10.3 # firefox -remote 'openURL(http://foo.bar,new-tab)' # doesn't work: # # Error: Failed to send command: 500 command not parseable # MY_BINARY=/usr/lib/firefox/firefox.sh MY_XREMOTE=/usr/lib/firefox/mozilla-xremote-client MY_XREMOTE_CALL='openURL(__URL__,new-tab)' if [ $# -eq 0 ]; then # no parameters - normal startup $MY_BINARY else # assume 1st parameter is an URL MY_URL="$1" MY_CALL="${MY_XREMOTE_CALL/__URL__/${MY_URL}}" # if remote call does not work # start normal firefox if ! $MY_XREMOTE "$MY_CALL" ; then $MY_BINARY "$MY_URL" fi fi