Selecting from multiple X configurations (layouts) automatically at GDM startup or at boot

I’m trying to use different configurations on my laptop :

  • standard linux kernel with proprietary nvidia driver
  • and Xen to allow developping/testing in a hosted dom-U Debian distro, in which case I switch back to the libre nv driver

When using the proprietary nvidia driver, I may use two kind of configurations :

  • having several screens in “clone” mode, i.e. replicated view on screen and beamer, for instance (classical use of Fn+F8 clone display)
  • or having both screens assembled into one to use twinview with dualhead, which provides (through Xinerama) and being able to switch windows from one to the other

This means I configured several layouts in the same xorg.conf file, which will describe each a different Xorg configuration.

Update 2008/02/10 : reorganized that post to be able to manage kernel-passed LAYOUT variable

Now, I want to have the correct layout automatically detected at X startup (launched by GDM), and/or being able to switch layouts manually at boot.

I adapted the howto HOWTO: Choose Xorg layout automatically based on ddcprobe in order to use the following script as /etc/gdm/startx-custom :


#!/bin/sh

# if no LAYOUT variable is defined in the environment (coming from kernel parameters ?)
if [ "x$LAYOUT" = "x" ]
then

# try to detect automatically
uname -r | grep -q -i xen
if [ $? -eq 0 ]
then
LAYOUT="-layout XenLayout"
else
LAYOUT=""
fi

else
# use the LAYOUT variable content
LAYOUT="-layout $LAYOUT"
fi

# run the X server with the eisa entry as layout (if it was defined in
# xorg.conf)
exec /usr/X11R6/bin/X $LAYOUT $*

Then, I configured GDM to use that one instead of the default X startup, adding this to /etc/gdm/gdm.conf :


# in [servers]
#0=Chooser
0=Xen

# then, bellow :
[server-Xen]
name=Standard server for Xen
command=/etc/gdm/startx-custom -br -audit 0
flexible=true

Due to the way Debian configures GDM, I couldn’t use a custom GDM conf file as stated in the docs, and had to modify /etc/gdm/gdm.conf (see
bug #360377)

Now, I modified my grub menu.lst config file so that my kernels can be invoked with LAYOUT=DualLayout or LAYOUT=CloneLayout parameters, for instance. So rebooting, I will select different layouts.

Also, it’s possible to do LAYOUT=NewLayout /etc/init.d/gdm restart commands, for instance.

Hope this helps.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

One Response to Selecting from multiple X configurations (layouts) automatically at GDM startup or at boot

  1. Pingback: WebLog Pro Olivier Berger » TwinView on NVidia video card : 2 displays for my laptop

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>