Monday, March 24, 2008

Multiseat in Ubuntu 8.04 (III)

<< step (II) <<

After the previous modifications, our system is almost ready to use. Unfortunately there are still some pending details to be resolved.

The first problem is to achieve having every Xephyr screen properly placed (one display for every Xephyr). The current Xephyr version does not support the geometry parameter that most X applications include, so it is not possible to place the Xephyr window in the desired place (i.e. one Xephyr on every display).

To workaround this problem we can use some command line tools in order to place every Xephyr window just in the place where we want to have it. We will need the following packages: xwininfo, wmctrl. Install them with your favorite tool (synaptic, apt-get).

The next step is to modify the gdm.conf file in order to invoke a wrapping script when calling the gdm greeter.

In our example, we have the following script wrapper placed in /usr/sbin just as we did with the Xephyr wrapper (be sure to give the script execution permissions):


#!/bin/bash
# /usr/sbin/Xephyr-login.sh

XAUTHORITY=/var/lib/gdm/:0.Xauth
XEP=$(xwininfo -root -children -display :0 | grep "Xephyr on :1" --max-count=1)
echo XEP ${XEP} >> /tmp/logXephyr
set -- ${XEP}
XAUTHORITY=/var/lib/gdm/:0.Xauth
DISPLAY=:0 wmctrl -i -r $1 -e 0,1280,0,-1,-1
/usr/lib/gdm/gdmlogin
# /usr/lib/gdm/gdmgreeter


In our particular case, we have tho displays at 1280x1024. Having the display resolutions hardcoded in such a script is very awful, so consider it just as a dirty and quick workaround to have things working. Experienced bash script coders with nicer solutions are welcome :-)

As we said before, you have to modify the /etc/gdm/gdm.conf file (the gdm greeter call) in order to call this script. The script will move one of the Xephyr sessions to the right display while maintaining the other on the left display.


# The greeter for attached (non-xdmcp) logins. Change gdmlogin to gdmgreeter
# to get the new graphical greeter.
# Greeter=/usr/lib/gdm/gdmgreeter
Greeter=/usr/sbin/Xephyr-login.sh


As you can see, when the greeter is expected to be invoked, the wrapper script (including greeter invocation) is executed instead.

The last comment is about the greeter. There is something wrong about screen size detection with the default gdm greeter (gdmgreeter). It always try to start at a resolution of 1600x1200, so we had to change to the old greeter (gdmlogin) which detects properly the screen resolutions of the Xephyr sessions.