#!/bin/bash
#
# RAWX11	: Example of a full-screen firefox session with no window manager, use FILE QUIT to exit firefox
# Verison 	: 1
#
#
#	!!!	DANGER	!!!
#	This code messes with firefoxes configuration for the user, use with a newly created scratch user and test 
#	it yourself. You are warned so not my fault if this buggers something .
#
#

xlogin-rootjpeg -display $DISPLAY -image black
cd $HOME


# Do some nasty stuff - for some reason the firefox developers where to fucking lazy to make -width and -height command
# line arguments work. So to work around we need to dick with profile for this user !

# With luck this will be the profile that firefox reads on startup
cd .mozilla
cd firefox
cd *.default



# Regenerate localstore.rdf from this pattern
cat <<EOM >TEMP
<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#sidebar-title"
                   value="" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul">
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#main-window"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-box"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-title"/>
  </RDF:Description>
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#main-window"
                   sizemode="normal"
                   screenX="0"
                   screenY="0"
EOM

echo width=\"$XWIDTH\" >>TEMP
echo height=\"$XHEIGHT\" >>TEMP

cat <<EOM >>TEMP

/>
</RDF:RDF>
EOM


mv TEMP localstore.rdf

firefox -width $XWIDTH -height $XHEIGHT "http://www.google.com"


# Important, wait for my child process (the desktop) to exit before I exit
wait

# Kill all my children!
kill -- $$ 

