Add an Xsession.post script for Fremantle to launch browser-switchboard on session...
authorSteven Luo <steven+maemo@steven676.net>
Sat, 28 Aug 2010 03:47:29 +0000 (20:47 -0700)
committerSteven Luo <steven+maemo@steven676.net>
Sat, 28 Aug 2010 07:34:04 +0000 (00:34 -0700)
Fremantle MicroB autostarts by default and listens on both the D-Bus
system and session buses, so applications may send requests on either
bus (even though those that send requests on the system bus should be
fixed).  We therefore need to duplicate this behavior, but we cannot
rely on D-Bus to launch us to handle a request coming in on the system
bus, since the system bus runs as the "messagebus" user, and we need to
run with the UID of the logged-in user.  A complete fix for Browser
Switchboard bug 5910 ("browser-switchboard should listen on D-Bus system
bus as well") on Fremantle therefore requires that browser-switchboard
be autostarted when the desktop environment comes up.

We arrange for this the same way browserd does on Fremantle -- with an
Xsession.post script that runs on X session startup.  Also, we prestart
MicroB if the current browser-switchboard configuration is to leave it
running in the background, to make opening the first MicroB window
faster.

Because we may start the MicroB browser process, this script needs to
be inserted after browserd's in the Xsession.post run order.

xsession-post.sh [new file with mode: 0755]

diff --git a/xsession-post.sh b/xsession-post.sh
new file mode 100755 (executable)
index 0000000..237a9cd
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# start Browser Switchboard, then start MicroB if appropriate
+/usr/bin/browser-switchboard > /dev/null 2>&1 &
+
+if ! /bin/pidof browser > /dev/null 2>&1; then
+       DEFAULT_BROWSER=`/usr/bin/browser-switchboard-config -b`
+       AUTOSTART_MICROB=`/usr/bin/browser-switchboard-config -o autostart_microb`
+       if [ "$AUTOSTART_MICROB" -eq 1 ] || [ "$DEFAULT_BROWSER" = "microb" -a "$AUTOSTART_MICROB" -ne 0 ]; then
+               /usr/bin/maemo-invoker /usr/bin/browser.launch > /dev/null 2>&1 &
+       fi
+fi