#!/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 perl-Win32-GUI, 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=`perl -m'Win32::GUI' -e'print Win32::GUI::GetSystemMetrics(78), " ", Win32::GUI::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
END
chmod +x $XINITRC

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

rm $CONFFILE
rm $XINITRC
