Posted by Steve on Tue 18 Jan 2005 at 11:14
For testing out Window managers, or developing applications it's sometimes useful to run more than one X11 Window session. Normally you'd do that by setting up X to run on another virtual terminal, but thats a bit awkward to use, and only works if you're physically in front of the machine. Instead you could run nested X11 sessions.
XNest allows you to start a new X11 session inside your current one, running completely seperate from it.
It's very useful for testing out Window Managers, as you can only have one window manager running at a time.
xnest is usually installed when you setup the X11 window system on Debian machines, but if it's not you can get it by running the following command as root:
apt-get install xnest
Usage is very simple:
Xnest -ac :2
This will create a new window which has the DISPLAY string set to ":2". (The -ac flag allows you to connect to it, and is important).
Once this is done you can run commands that will display inside that by adding "-display :2" to their command line, such as:
xterm -display :2
This will give you an xterm running inside your new X11 environment.
To run a new window manager run:
/etc/alternatives/x-window-manager -display :2
This will give you your default window manager in the new session, which you can use to execute programs, etc.
If you wish to test out a new window manager, such as xfce you can do that by running as root:
apt-get install xfce4
Then:
Xnest -ac :22 & export DISPLAY=:22 xfce4-session &
This sets up a new X11 session running as ":22", and then starts a copy of the xfce environment inside it.
If you like it you can set this up as your primary window manager, if not you can just remove it..
This article can be found online at the Debian Administration website at the following bookmarkable URL:
This article is copyright 2005 Steve - please ask for permission to republish or translate.