[Xmonad] Xinerama

Aldo Cortesi aldo at nullcube.com
Tue Jun 12 10:33:10 EDT 2007

Hi folks,

I'm seeing symptoms similar to the the same Xinerama-related problem reported


In that same thread, Jason Creighton suggested running the following test

    import Graphics.X11.Xlib
    import Graphics.X11.Xinerama

    main = do
        d <- openDisplay ""
        xineramaQueryScreens d >>= print
        getScreenInfo d >>= print

On my system, this outputs:

[Rectangle {rect_x = 0, rect_y = 0, rect_width = 1920, rect_height = 1200}]

Now the plot thickens. The following snippet of C should be very nearly
equivalent to the script above:

#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include <stdio.h>
#include <stdlib.h>

int main (){
    Display *dpy;
    XineramaScreenInfo *xsi;
    int i, num;
    dpy = XOpenDisplay("\0");
    printf("%s\n", XDisplayString(dpy));
    if((xsi = XineramaQueryScreens(dpy, &num))) {
        printf("%i screens\n", num);
        for(i = 0; i < num; i++) {
           printf("%i: %ix%i\n", xsi[i].screen_number, xsi[i].width, xsi[i].height);
    return 0;

However, from this, I get the following output:

2 screens
0: 1920x1200
1: 1280x1024

As you can see, the Xinerama screens are detected correctly. Xinerama under
other window managers (e.g. KDE) also seems to work flawlessly with the same X
configuration. Despite this is being my first real foray into Haskell, I
bravely ploughed through the appropriate bindings in X11-extras and X11-1.2.2,
but I could see no obvious errors. 

I have a hunch that the problem is related to the fact that I have an NVidia
graphics card with TwinView (NVidia's magic sauce that allows you to connect
multiple screens to the same GPU). Apparently, Twinview is known to cause
problems with some window managers - see, for example, the FAQ section of this
page from NVidia:


The FAQ entry is pretty vague about exactly what form these "problems" might

I'm keen to give XMonad a try, so I'd be happy to spend time helping to
troubleshoot this problem...



Aldo Cortesi
aldo at nullcube.com
Mob: 0419 492 863

More information about the Xmonad mailing list