Short Xnest tutorial
Short Xnest tutorial
Okey, a short tutorial about Xnest. Xnest is a nested Xserver. It’s a part of XFree86. This means it’s both an X-server and a X-client. So you’ve got an X-server running in a window.
This is quite nice for making screenshots, testing another window manager, running two window managers (though 2 real X-servers are better in that case) and of course testing if the window manager still works after you changed it a little bit and recompiled
I’m using Debian myself, but it should also work on other distro’s. The first thing you need to do is find an Xnest package for your distro, because it isn’t standard.
On Debian, an apt-get install xnest is all you need.
We’re going to run it on :3, which shouldn’t pose a problem unless you’re already running X multiple times.
Xnest :3 -ac -geometry 800x600 1>/dev/null 2>/dev/null & in an terminal should do the trick, if it doesn’t work (I’ve got some complaints about Fedora) try
Xnest :3 -ac -geometry 800x600 -display :0 1>/dev/null 2>/dev/null &
This seems quite complicated, but it isn’t really complicated:
- Xnest is the name of the Xnest server
- :3 is the X display it should run on, you’ll need it later on. -ac means no acces control. Programs are not allowed to connect to an Xserver, unless you configured it that way. (security)
-geometry 800x600should be clear, it’s the size.- Everything behind that is to make sure it doesn’t give output into the terminal.
-display :0is to let Xnest connect as a client to the server running at :0
Ok, if everythings all right, you see an Xnest window coming up. If you don’t see it, try to leave out 1>/dev/null 2>/dev/null & and see what the error is.
You shouldn’t try to kill it with ctrl-alt-backspace, that will kill your main one
The closebutton seems to pose the problem that it leaves the lock file. Entering killall Xnest in a teminal works fine though.
Ok, now we want to run an desktop environment/window manager. Don’t try to run the one you’re already running, because you’ve got an lockfile locking it. (And it isn’t smart to remove that one)
I’ve also got fluxbox and xfce4 installed, I’m going to explain xfce4 more detailed, because that was the most complicated one.
DISPLAY=:3 fluxbox works perfectly to start fluxbox. We first set the display to :3, which is our Xnest.
DISPLAY=:3 xfce4-session doesn’t work, it says a session manager is already running. To bypass this problem you could use DISPLAY=:3 SESSION_MANAGER= xfce4-session. This unsets The $SESSION_MANAGER environment variable, and solves our problem..
We now have a nice desktop environment running in another one. (It’s quite slow though, Quake2 just makes 5fps, while it makes 90 in Xorg)
There are some problems to. A lot of programs like firefox and xmms can’t be started multiple times by the same use. You can solve this by running the programs as another user. You can make another user, like demo, but in one of these screenshots I was running xmms multiple times, at least one time just open, and one playing. I excecuted it as root user, but please don’t do that because that isn’t secure. Never run programs as root unless really needed
Maybe the best part, two of the screenies I made, both showing KDE 3.5.1 running, and Xnest. Of course running under Xorg. Both Debian screenshots
The first screenie is fluxbox with quake2 (demo) open in the Xnest server/client, and the second one shows xmms open in xfce4.



