Open Source

Tech Tip: Run X within X

Find out how to run X within X.

XFree86 is the basis for any graphical interface on Linux systems. It's very powerful even if it is somewhat dated in many ways.

One of the advantages of using XFree86 is that you can use a program called Xnest to run one X session inside another. Known as nesting an X session (as indicated by the name), this process allows you to run another full X session without leaving your current session.

To nest an X session, open an xterm or similar console in X, and enter the following:

$ Xnest :1 -ac &

This starts another X session, giving it the session identifier :1. ((By default, X starts with session :0.) This command opens a new window titled Xnest, which displays a blank or solid color background.

You can now start a window manager, such as Window Maker, inside the new session by executing the following:

$ DISPLAY=:1 wmaker &

In the new nested session, you can pretty much do anything you would in a regular X session. When launching programs from outside the nested session, you need to set the DISPLAY environment variable to direct programs to start inside the session. You should also background the programs so they don't run inside the session and sit in the foreground of your terminal.

0 comments

Editor's Picks