Previous Section  < Day Day Up >  Next Section

Recipe 15.12. Running Different Window Managers Simultaneously with Xnest

15.12.1 Problem

You have all these great window managers and desktop environments installed—KDE, Gnome, Enlightenment, Fluxbox, XFce, and such—and you would like to run some of them simultaneously. You know you can start up separate additional X sessions, or log out of X and start up in another window manager, but you wonder if there isn't a way to run them at the same time.

15.12.2 Solution

Xnest, the "nested X server," is just the tool for the job. Xnest allows you to run additional X sessions inside of already running X sessions.

Open a command shell in any X session—let's say you're running IceWM—and fire up Xnest:

$ Xnest -ac :1

You should see a blank screen with an X cursor in the middle. Now you can open a window manager. This example starts up WindowMaker:

$ wmaker -display :1

Now you can start up another one. From a command shell on IceWM, enter:

$ Xnest -ac :2

Some window managers or desktop environments, such as Gnome, need to start from an xterm in the Xnest window. First start up an xterm:

$ xterm  -display :2

Then start Gnome from the xterm:

$ gnome-session

You can start up yet another Xnest session from any available terminal in any of the windows:

$ Xnest -ac :3

You can continue to open more window managers until your system resources are exhausted and everything slows to a crawl. Figure 15-1 shows Gnome inside of IceWM, on KDE.

Figure 15-1. Gnome


15.12.3 Discussion

X sessions are numbered from 0, so the default X session is always :0. The -ac option to Xnest specifies the session number for the new display. Keep track of your whereabouts by checking the DISPLAY value:

$ echo $DISPLAY

:0.0

The -ac option disables access controls. Otherwise, X will not let you open any applications. Xnest uses the same options as the X command—see xserver(1x).

When you get several window managers going, you might see an error message like this, and the new one won't start:

$ gnome-session

gnome-session: you're already running a session manager

No problem. Just track it down and kill it:

$ echo $SESSION_MANAGER

local/windbag:/tmp/.ICE-unix/2774

$ rm /tmp/.ICE-unix/2774

and now Gnome will start.

15.12.4 See Also

    Previous Section  < Day Day Up >  Next Section