Browser Startup

I've noticed an annoying little problem with a couple of open source web browsers namely Seamonkey and Kazehakase. Both of them have the same problem when you run them the normal way, ie by entering they're name on the command line, they fail to do anything if you already have the program open nothing happens. I'd prefer if they instead opened a new window, so I've written scripts to "fix" this. Basically each of the scripts checks to see if the program is already open and if so simply open a new window, otherwise they start the program. Both scripts work slightly differently but accomplish nearly the same task (the Kazehakase one will not open a link in the new window).

First we have seamonkey-start:

#!/bin/bash
# Simple start script for seamonkey
# Tries to open a new window with an already running instance, if it can't do
# that it starts a new seamonkey instance.
if [ $# == 0 ]; then
    if ! seamonkey -remote "xfeDoCommand(openBrowser)"; then
        seamonkey -splash;
    fi
else
    if ! seamonkey -remote "openURL($1, new-window)"; then
        seamonkey $1;
    fi
fi

And next up the kazehakase-start:

#!/bin/bash
# Simple start script for Kazehakase
# Checks for an already running instance, if so opens a new window, else starts
# Kazehakase.
if [[ `ps -e | grep kazehakase | grep -v kazehakase-star` != "" ]]; then
    kazehakase --action "KzWindow/NewWindow";
else
    kazehakase $1;
fi

I'm placing both scripts in the public domain so your welcome to do what ever you like with them. If you want to use them on your own computer just copy and paste.

Categories: Howto, Computers, Scripting
Date: 2008-03-19 23:03:56, 16 years and 281 days ago

Leave reply

No html allowed in reply

Notify me of follow-up comments via email.