[maemo-developers] [maemo-developers] browser launch from shell script

From: Tomi Ollila tomi.ollila at guru.guru-group.fi
Date: Sat Dec 16 15:58:37 EET 2006
I've been searhing a way to launch browser from shell script, and this
is the only way I've found (couple of references):

--8<----8<----8<----8<----8<----8<----8<----8<--
#!/bin/sh
#open a url passed as $1 (found on maemo-developers ml)

if ! dbus-send --system --type=method_call  --dest="com.nokia.osso_browser" --print-reply /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"$1" ; then
    DISPLAY=:0 run-standalone.sh /usr/bin/browser &>/dev/null &
    sleep 5
    dbus-send --system --type=method_call  --dest="com.nokia.osso_browser" --print-reply /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"$1"
fi
--8<----8<----8<----8<----8<----8<----8<----8<--

Is there a better way, or should I just use the following:

--8<----8<----8<----8<----8<----8<----8<----8<--
#!/bin/sh

send_url ()
{
    dbus-send --system --type=method_call --dest=com.nokia.osso_browser \
        --print-reply /com/nokia/osso_browser/request \
        com.nokia.osso_browser.load_url string:"$1" && exit 0
}

send_url "$1"
DISPLAY=:0 run-standalone.sh /usr/bin/browser >/dev/null 2>&1 &
for _ in 1 2 3 4 5 6 7 8 9; do sleep 1; send_url "$1"; done
exit 1
--8<----8<----8<----8<----8<----8<----8<----8<--


Tomi

More information about the maemo-developers mailing list