Log in
03
October

That’s a big title, eh? I blogged previously about setting up a multi-head X environment for development and testing, even though I’m working on a laptop with only one card. My previous attempt used Xdmx and multiple Xephyr displays, and there were some problems with it. Thankfully, Lubos commented about his nifty little fakexinerama library that achieves the same result only MUCH easier (easierly?) and without any of the problems that I’d seen using Xdmx/Xephyr(1..n). Here, then, is a description of what I’ve done and the results….

This is a screenshot from within the Xephyr session, showing the 1600×1200 Xephyr display. The cool thing is that using ksnapshot from within the Xephyr session will actually capture the entire display, not just what fits on your host display. This is important for me because my laptop LCD display is only 1680×1050, so I can’t actually fit the entire Xephyr display inside my real physical display. Nice to know, definitely, since this means that I can create a monstrous Xephyr display that doesn’t fit inside my actual host display and still get full-display snapshots out of it. So what you see here is a KDE3 session spanning all 4 Xinerama heads. Kicker correctly only spans head 1. VMware Workstation is on head 2, in full-screen mode, but only full-screened on the second head. It can span more than 1 head as I’ll show further down.

screenshot-ws-fullscreen-enabled

To achieve this, I downloaded seli’s fakexinerama library, compiled it in ~/build/ like this:

gcc -O2 -Wall Xinerama.c -fPIC -o libXinerama.so.1.0 -shared
ln -s libXinerama.so.1.0 libXinerama.so.1
ln -s libXinerama.so.1 libXinerama.so

I then copied the real /usr/lib/libXinerama.so.1.0.0 to /usr/lib/libXinerama.so.1.0.0.real (make sure you backup your library!) and set up an alias in my ~/.profile so that I can easily switch on and off this fake xinerama library. When I start up my real host session, I don’t want to be using fakexinerama, but when I launch my Xephyr session for multimon development, I do need it to be there.

xin () {
if [ "$1" = "real" ]
then
sudo cp /usr/lib/libXinerama.so.1.0.0.real /usr/lib/libXinerama.so.1.0.0
elif [ "$1" = "fake" ]
then
sudo cp ~/builds/libXinerama.so.1.0 /usr/lib/libXinerama.so.1.0.0
else
echo “real or fake?”
fi
}

Here’s the contents of my ~/.fakexinerama config file:

#Configuration file ~/.fakexinerama
#
# The format of the file is rather strict. Lines beginning with # are comments. First line is one
# number, specifying number of screens. This line must be followed by this number of lines, each
# containing four numbers: X Y W H, i.e. screen’s X and Y origin, width and height.
4
0 0 800 600
800 0 800 600
0 600 800 600
800 600 800 600

This establishes a 2×2 4-head xinerama configuration. Next up is creating the Xephyr display. From within your regular host session:

Xephyr :2.0 -ac -br +xinerama -screen 1600×1200 &
xterm -display :2&

You should now have a single Xephyr screen that’s 1600×1200 pixels with an xterm running inside of it. Now switch focus to the new xterm window and turn on the fakexinerama library and start up a KDE3 session:

xin fake
startkde
# (and when you’re done with this little environment, make sure you return your system to sanity by running “xin real”)

That’s about it. Really cool stuff. One last little screenshot… This one shows VMware Workstation spanning multiple heads. This obviously works with real external monitors as well. The way it works is by clicking the little monitor button to the right of the “View” menu. This tells Workstation to cycle through the available display topologies. So, on first press, Workstation spread across all 4 heads (fullscreen multimonitor, largest topology). Second press took on this configuration that I screengrabbed (vertical span). Third press spread Workstation horizontally across the first 2 heads. And then 4th press returned Workstation to just fullscreen on head 2 (where I started it from).

screenshot-ws-fullscreen-enabled-multimonvert

One last thought on the subject… One of the things I’m hopefully going to be able to work on in the next couple of months is implementing the new EWMH _NET_WM_FULLSCREEN_MONITORS hint in various X window managers. Currently, Workstation does some internal gyrations to convince window managers to allow our undecorated fullscreen window to maximize over multiple monitors/heads. _NET_WM_FULLSCREEN_MONITORS was the hint that was recently added to the EWMH spec to correctly accomplish this, but as far as I know, it hasn’t been added to any window managers yet. I’m excited about getting the chance to get up to speed on some window manager internals again! It’s been a while since I’ve last had the chance to do that (bbkeys/blackbox days of yore!).

Anyway, hope this helps someone else set up a multi-head dev/test environment, should the need arise. =:)

11 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. kdeluser

    I wonder if it is possible to tie different workspaces to each xinerama head? THAT would be great!

    When I work with xinerama on two monitors, I would love to switch workspace independently on each monitor(with kwin)

    Friday October 3, 2008 at 3:00 pm
  2. anonymous

    Very sweet. This means that one can now use one single monitor and fake two displays !
    So I could use one half of a 32” 1900×1080 big LCD TV-screen to display pdf files in “full window mode” and the other half to do real work, using maximized windows who never will obscure my pdfs… I like it :-D

    Friday October 3, 2008 at 3:24 pm
  3. Michael "Grammar" Howell

    … only MUCH more easily …

    Sunday October 5, 2008 at 11:44 pm
  4. Jason 'vanRijn' Kasper

    @Michael: =;) Thanks.

    Monday October 6, 2008 at 1:06 am
  5. Bert Wesarg

    Thanks for these posts.

    But shouldn’t this work too:

    Xephyr :1 -ac -br +xinerama -origin 0,0 -screen 640×480 -origin 640,0 -screen 640×480 -origin 0,480 -screen 640×480 -origin 640,480 -screen 640×480

    ?

    You have 4 ‘real’-Xephyr windows but the mouse movement is a little strange.

    Friday October 24, 2008 at 5:35 am
  6. Jason 'vanRijn' Kasper

    Hi Bert! =:) I tried your command, but I only got one Xephyr window? It does think it has 4 heads, but there’s only one Xephyr window, sized 640×480??

    Monday October 27, 2008 at 1:48 am
  7. Daniel

    KDE 4.2b2 should now have suport for _NET_WM_FULLSCREEN_MONITORS EWMH spec hint
    http://techbase.kde.org/Schedules/KDE4/4.2_Changelog#KWin

    Tuesday December 23, 2008 at 4:47 pm
  8. Jason 'vanRijn' Kasper

    Hi Daniel! =:) Yep, I know… I put it there. =:)

    Tuesday December 23, 2008 at 7:02 pm
  9. Christopher Michael

    I was wondering where that background is from…the dark one with the katana ? Would it be possible to get it ?

    Thanks :)

    devilhorns

    Tuesday December 15, 2009 at 12:35 am
  10. Jason 'vanRijn' Kasper

    Hey @Christopher! I believe it’s this one: http://web.me.com/ctt1wbw/Katana2.jpg.The filename I have on my hard drive is 200807052623-7698.jpg. I think I got it from deviantart or socwall originally. HTH! =:)

    Tuesday December 15, 2009 at 8:42 am
  11. Christopher Michael

    Thank you very much Jason ! :) I noticed on one of your other posts that you were modifying window managers…I am a developer for Enlightenment so if there is anything I can do for you, let me know :)

    Cheers,
    devilhorns

    Tuesday December 15, 2009 at 2:22 pm

Some HTML is OK

or, reply to this post via trackback.