Update (2 Dec 2005): kiosk extension is broken, I'm now using a hacked browser.jar (version 1.0.7), I made a few changes to xinitrc-common as well
Simple kiosk implementation, not entirely thorough, but enough for our purposes. Machine boots and gdm logs into a user without a password, firefox starts fullscreen and opens our homepage. Simple to implement.
- kiosk extension is incomplete, you can open a new browser window and circumvent the chrome security, I changed my browser.jar file to take away this functionality, here is a patch: kiosk.patch browser.jar
- kiosk extension
[root@host] # firefox -install-global-extension /full/path/to/kiosk_browser_symbio_technologies_-1.0-fx-linux.xpi
- patched kiosk1.xul to open homepage (add loadOneOrMoreURIs after Startup):
cd /usr/lib/firefox-*/extensions/{*}/chrome patch -p0
homepage.patch:--- content/kiosk1.xul.loadHome 2005-11-28 11:21:53.000000000 -0500 +++ content/kiosk1.xul 2005-11-28 11:23:30.000000000 -0500 @@ -31,7 +31,7 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onload="Startup()" onunload="Shutdown()" onclose="return WindowIsClosing();" + onload="Startup();loadOneOrMoreURIs('http://www.ias.edu')" onunload="Shutdown()" onclose="return WindowIsClosing();" contenttitlesetting="true" title="&mainWindow.title;" titlemodifier="&mainWindow.title;"
- patched browser.js in browser.jar to redirect file:/// resource:/// and about:/// requests to home page
as seen on this site
cd /usr/lib/firefox-*/chrome TMPDIR=`mktemp -d` unzip -q browser.jar -d $TMPDIR pushd $TMPDIR patch -p0 /usr/local/etc/browser-js-location.patch zip -q -r -D browser.jar * popd rm -rf browser.jar mv $TMPDIR/browser.jar . rm -rf $TMPDIR
browser-js-location.patch:--- content/browser/browser.js_kiosk 2005-11-28 11:11:43.000000000 -0500 +++ content/browser/browser.js 2005-11-28 11:12:43.000000000 -0500 @@ -2857,7 +2857,14 @@ this.setOverLink("", null); var location = aLocation.spec; - + if (location.match(/^file:/) || + location.match(/^//) || + location.match(/^chrome:/) || + location.match(/^resource:/) || + (!location.match(/^about:blank/) && + location.match(/^about:/))) { + loadURI("http://www.math.ias.edu"); + } if (location == "about:blank") location = "";
-
patch langpacks to open our home page: #!/bin/sh FIREFOX_LIBDIR=/usr/lib/firefox-1.0.7 # set homepage to www.math.ias.edu cd $FIREFOX_LIBDIR/chrome for i in `ls *.jar`; do rm -rf locale LANGPACK=`basename $i .jar` TMPDIR=`mktemp -d` unzip -q $LANGPACK.jar -d $TMPDIR pushd $TMPDIR perl -pi -e "s|browser.startup.homepage=.*$|browser.startup.homepage=http://www.ias.edu|g;" locale/browser-region/region.properties zip -q -r -D $LANGPACK.jar * popd rm -rf $LANGPACK.jar mv $TMPDIR/$LANGPACK.jar . rm -rf $TMPDIR done
- configure gdm to login automaticaly to a specific user, do not give the user a password.
useradd kiosk
/etc/X11/gdm/gdm.conf:AutomaticLogin=kiosk TimedLogin=kiosk
- hack xinitrc-common to start metacity and a firefox kiosk window.
/etc/X11/xinit/xinitrc-common:
--- xinit/xinitrc-common_firefoxonly 2005-11-28 11:48:40.000000000 -0500 +++ xinit/xinitrc-common 2005-11-28 11:52:08.000000000 -0500 @@ -61,3 +61,5 @@ DBUS_LAUNCH= [ -x /usr/bin/dbus-launch -a -z "$DBUS_SESSION_BUS_ADDRESS" ] && DBUS_LAUNCH="/usr/bin/dbus-launch --exit-with-session" +/usr/bin/metacity --sm-disable & +# remove lock file (incase we crashed) +/bin/rm -f /home/kiosk/.mozilla/firefox/*.default/lock +exec firefox -fullscreen -chrome chrome://kiosk1/content/kiosk1.xul
- modify localstore.rdf to always start firefox fullscreen
this part is manual, startup your machine and wait for firefox to start, this will create the user kiosk's profile dir
go to a virtual console and stop gdm
[root@host] # init 3 [root@host] # cd ~kiosk/.mozilla/firefox/*/ [root@host] # chown root localstore.rdf
edit localstore.rdf and set sizemode="maximized"width="610" height="450" screenX="89" screenY="40" sizemode="maximized" />
-
For the main window without kiosk:
width="610" height="450" screenX="89" screenY="40" sizemode="maximized" />With sed:
[root@kiosk]# sed -e 's/(sizemode=\").*\"/1maximized\"/' ~kiosk/.mozilla/firefox/*.default/localstore.rdfsince localstore.rdf is owned by root, firefox can't overwrite this setting (this probably introduces other problems, but none that we've seen yet...), you can also put this in localstore.rdf in the firefox lib dir, but the user's localstore.rdf will override this.