#!/bin/sh

# Toggle the Movable Window Hack for Easy Debian applications.
# (c) 2008 Alan Bruce (qole): GPL license.

# Shut down Matchbox Window Manager.

. /etc/osso-af-init/af-defines.sh
. /etc/osso-af-init/matchbox.defs
echo dialogmode=$DIALOGMODE 
echo stopping matchbox...
. /etc/osso-af-init/matchbox.sh stop

# Figure out what mode we're running in, and switch to the other one.

if [ ! "x`grep -i DIALOGMODE=free /etc/osso-af-init/matchbox.defs`" = "x" ] ; then
 echo "free mode: switching to static."
 sudo cp /etc/osso-af-init/matchbox.defs.orig /etc/osso-af-init/matchbox.defs
else
 echo "static mode: switching to free."
 sudo cp /etc/osso-af-init/matchbox.defs.window-hack /etc/osso-af-init/matchbox.defs
fi

# Start up Matchbox Window Manager again, with the new settings.

. /etc/osso-af-init/af-defines.sh
. /etc/osso-af-init/matchbox.defs
echo dialogmode=$DIALOGMODE 
echo starting matchbox...
. /etc/osso-af-init/matchbox.sh start