#!/bin/bash
#
# Simple shell script to launch an experimental Firefox desktop.
# If X is already running, switch to another virtual terminal
# (e.g. Ctrl-Alt-F2) before running this program. You may have to
# wait 45 seconds or more for everything to finish loading.
#
# You will need the TightVNC server and Java applet viewer installed.
# You will also need a local Web server to actually use the desktop;
# see the comment at the end of this script for an example Web page.
#
# Since Firefox runs without a window manager, you can install the 
# Web Developer Toolbar extension:   
#   https://addons.mozilla.org/en-US/firefox/addon/60
# to control the window size.
#
# *** If you use a similar configuration over a network (i.e. the
# *** browser is on a different machine from the VNC server) remember
# *** to protect the VNC traffic (usually by tunnelling over SSH).

# Start a Gnome desktop.
tightvncserver :1 -geometry 800x600 
unset SESSION_MANAGER
gnome-session --display :1 &

# Start OpenOffice.  You can use another window manager, such as Ion.
# In general, a tiling window manager works best here.
tightvncserver :2 -geometry 800x600 
ratpoison --display :2 &
sleep 3  # Wait a little until ratpoison is ready for commands.
         # This is *not* reliable for production use.
ratpoison --display :2 -c 'exec openoffice' 

# Start Firefox.  The part of the line after the "--" sets the X
# display; the default is 0.  If you already have an X session
# running, display 0 is probably taken.
xinit /usr/bin/firefox -- :3

# Example Web page for the experimental Firefox desktop.
# The viewer applet should be in the "classes" subdirectory,
# in the same directory as the Web page.  Note the port parameter;
# 5901 corresponds to X display 1, 5902 to X display 2, etc.
#
# You will need two such pages (one with port 5901, the other with
# 5902) to display the Gnome desktop and OpenOffice, launched above.
# Browse to "localhost/<PAGE NAME>".  You can bookmark these pages
# just like any other page.
#
#   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" 
#     "http://www.w3.org/TR/REC-html40/strict.dtd"><html>
#   <head>
#   <title>Local Desktop</title>
#   </head>
#   <body>
#   <div style="text-align: center;">
#   <object data="java:VncViewer.class" codebase="classes/" 
#      type="application/x-java-applet" width=800 height=600>
#   <param name="type" value="application/x-java-applet">
#   <param name="code" value="VncViewer.class">
#   <param name="codebase" value="classes/">
#   <param name=PORT value=5901>
#   <param name="Show controls" value="no">
#   </object>
#   </div>
#   </body>
#   </html>

