+
+ if [ -n "$XINERAMA" ] ; then
+
+ print "$fg[green]
+
+Option for $fg[yellow]Xinerama$fg[green] found, please use xrandr inside X.org for your further configuration!
+Trying to identify monitors now..."
+
+ # make sure we have information from 2 monitors:
+ # - first one from 'hwinfo --monitor' => $MONITORINFO
+ # - second one from 'hwinfo --framebuffer' => $FRAMEBUFFER
+ FRAMEBUFFER=$(hwinfo --framebuffer | grep 'Mode 0x.* bits' | head -1)
+ if [ -z "$FRAMEBUFFER" ] ; then
+ print "$fg[red]
+Fatal: could not identify two monitors - no chance to
+ set up multihead using Xinerama - sorry. :-(
+
+Please run grml-x without the -xinerama option to start
+X anyway (dropping support for Xinerama of course) and
+contact grml developers if you have any further useful
+information. => http://grml.org/bugs/
+"
+ bailout 10
+ fi
+
+ # check whether we can read the $MONITORINFO file
+ if ! [ -r "$MONITORINFO" ] ; then
+ print "$fg[red]
+Fatal: could not identify monitor - no chance to
+ set up multihead using Xinerama - sorry. :-(
+"
+ bailout 11
+ else
+ # Currently we only know that it works with current intel driver,
+ # so inform user about that:
+ if [[ "$MODULE" != "intel" ]] ; then
+ print "$fg[red]
+
+Warning: using a non-intel driver - trying Xinerama setup anyway.
+If it worked please contact grml developers providing information
+about your setup so we can adjust grml-x according!
+
+ -> http://grml.org/contact/
+
+Sleeping for 10 seconds now... Will continue then...
+Just press Ctrl-C to cancel operation.
+"
+ sleep 10
+ fi
+
+ # now calculate Virtual size for use with Xinerama
+ HORIZ_RES1="$(grep 'Max. Resolution:' $MONITORINFO | sed 's/ Max\. Resolution: \(.*\)x\(.*\)/\1/')"
+ VERIZ_RES1="$(grep 'Max. Resolution:' $MONITORINFO | sed 's/ Max\. Resolution: \(.*\)x\(.*\)/\2/')"
+ # it might happen that we don't have a Max Resolution in hwinfo output :-/
+ # fall back to a generic value then...
+ # TODO: check out how to get resolution of external monitor from console
+ if [ -z "$HORIZ_RES1" ] ; then
+ HORIZ_RES1="1024"
+ VERIZ_RES1="768"
+ fi
+
+ # get maximum of output
+ HORIZ_RES2="$(echo $FRAMEBUFFER | grep 'Mode 0x' | sed 's/ Mode 0x.*: \(.*\)x.*/\1/'| sort -u | head -1)"
+ VERIZ_RES2="$(echo $FRAMEBUFFER | grep 'Mode 0x' | sed 's/ Mode 0x.*x\(.*\) (.*/\1/' | sort -u | head -1)"
+
+ if [ -n "$HORIZ_RES1" -a -n "$VERIZ_RES1" -a -n "$HORIZ_RES2" -a -n "$VERIZ_RES2" ] ; then
+ if [ "$(echo $VERIZ_RES1" - "$VERIZ_RES2 | bc -l)" -eq 0 ] ; then
+ VERIZ_RESULT="$VERIZ_RES1"
+ elif [ "$VERIZ_RES1" -gt "$VERIZ_RES2" ] ; then
+ VERIZ_RESULT="$VERIZ_RES1"
+ else
+ VERIZ_RESULT="$VERIZ_RES2"
+ fi
+
+ HORIZ_RESULT=$(echo $HORIZ_RES1 + $HORIZ_RES2 | bc -l)
+
+ # important: keep newline for appropriate placing below $MODES!
+ if [ -n "$HORIZ_RESULT" ] ; then
+ VIRTUAL="
+ Virtual $HORIZ_RESULT $VERIZ_RES1"
+ fi
+ fi
+ fi
+ fi
+