Running Multiple Window Managers with Xnest

My favorite window manager is currently fluxbox but I recently wanted to try out wmii. So I searched for a way to run multiple window managers and still be able to switch between them. This is were Xnest comes in. With Xnest it is possible to - well - nest a X server.

We have to pass another display number to Xnest because the default :0 is normally already in use.

Xnest -ac :1

Afterwards we can start any application on our nested X server. The easiest way is probably to launch a terminal and issue further commands from there.

xterm -display :1

Note that within our new xterm the display environment variable is set accordingly:

echo $DISPLAY
:1.0

Another way would be to simply set the display variable to 1 instead of 0 in the terminal where you started Xnest. All application will redirect their graphical output to the nested X server.

export DISPLAY=":1.0"

Next step would probably be to start a window manager in my case I just typed wmii in my xterm and everything worked as expected.