box.matto.nl

home/

Fun with Xnest HowTo

Last edited

Xnest is a great tool to simultaneously use multiple window managers

Xnest lets you start multiple (nested) X-sessions on the same box simultaneously. This provides great fun, and sometimes can even be very useful. Every Linux user should have tried it!

Xnest tutorial: Learn Xnest in just 5 minutes

This tutorial teaches you to use Xnest in just 5 minutes. Xnest is very useful and fun to play with!

Why use Xnest

Things you might want to do with Xnest:

  • You are running ratpoison, a very good windowmanager, and need to do something which ratpoison is not good at (playing with gimp). With Xnest you can open a new screen, start a new windowmanager in that and do what you have to do, while still running ratpoison for every thing else.
  • When running a lesser windowmanager, start Xnest, run ratpoison in it an learn to work with ratpoison.
  • Try out other windowmanagers and discover why you should definitely turn to ratpoison.

Starting a Xnest session

  • First, check if you have Xnest installed. If not, do so now.
  • You must be running X.
  • Then start a simple Xsession:
    Xnest :1 -ac &
    xclock -display :1
    

Now you should see a X-screen without a background and a Xclock on it. If this works, you're in business :-)

The :1 in the example above, is the number of your Xsession. :0 is your "regular" Xsession. So if you want to simultaneously open several Xnests, you should change this number:

Xnest :1 -ac &
Xnest :2 -ac &
Xnest :3 -ac &
etc.

Starting a windowmanager in the Xnest-screen

Kill the xclock with <Ctrl-C>.
Next we are going the start a windowmanager. We start with twm (many distros install twm by default, if not then install it first) an ancient but still usable windowmanager:

twm -display :1

Perhaps you see nothing happening, but if you click with your left or right mouse-button in the Xnest screen, you should.

This way you can try many different windowmanagers to find out what your favorite could be.

Some problems you might run into:

  • Not every windowmanager understand the switch "-display :1"
    f.e. ratpoison and afterstep are started with -d :1
    As always, consult the man-pages.
  • Some windowmanagers don't like to be started twice

Here you find a screenshot of a Xnest session with fvwm as windowmanager, opening a Xnest session with ratpoison as windowmanager, opening a Xnest session with afterstep as windowmanager.

Play around, experiment and have fun. It could be nice to work as several users different on your system, so that will be our next experiment:

Setting up an ratpoison session as a different user

xhost +
su - different_user
export DISPLAY=ipnumber:0
Xnest :4 -display :0 &
ratpoison -d :4

Explanation:

  • xhost +
    Let others connect to your current X-session
  • su - different_user
    Become user different_user
  • export DISPLAY=ipnumber:0
    Let the different_user-applications connect to the current X-session.
    ipnumber = the ip-number of your system.
  • Xnest :4 -display :0 &
    Start Xnest on display number 4 of the current X-session
  • ratpoison -d :4
    Start the coolest windowmanager on display number 4 and start rocking!

Use Xnest to login to a remote Xserver

To connect to a remote Xserver, you would normally do something like X -query <hostname> or X -query <ip-address>.

This is not much different when using Xnest.

Xnest :1 -query <ip-address>

You can use here either the ip-address or the hostname of the Xserver.

Which windowmanagers are there to play with?

Open source software always inspire people to develop more and more applications. There is a wide range of window managers available. Take a look at xwinman.org - windowmanagers for X and take your pick!

For this kind of experimenting you will find Debian most suited. Most applications are only an apt-get away ...