#!/bin/sh
#
# What I hope is a temporary script to do the things needed to use XtoW
#

# this is rather round the houses, and introduces a dependency on python, but is a lot quicker than
# adding RANDR 1.2 support to xf86-video-dummy and then using RANDR to resize the display when XtoW starts.
DIMENSIONS=`python -c 'from ctypes import *; print cdll.user32.GetSystemMetrics(78), cdll.user32.GetSystemMetrics(79)'`

CONFFILE=`mktemp`
cat >$CONFFILE <<END
Section "Device"
        Identifier  "Device0"
        VideoRam 16384
        Driver  "dummy"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device "Device0"
        SubSection "Display"
                Virtual $DIMENSIONS
        EndSubSection
EndSection
END

XINITRC=`mktemp`
cat >$XINITRC <<END
xwinclip &
urxvt -fn fixed -depth 32 -bg rgba:0000/0000/0000/4444 &
xtow &
xwin-xdg-menu
END
chmod +x $XINITRC

xinit $XINITRC -- /usr/bin/Xorg -displayfd 3 -config $CONFFILE

rm $CONFFILE
rm $XINITRC
