Cooking with Linux - Can't Get Enough Desktops!
Ah, François, I see you have decided to run Window Maker—excellent. It's a great window manager, and I think you'll enjoy it. Two weeks ago, you were running GNOME; last week it was KDE, and now it's Window Maker. I'm glad you took my advice and decided to try other desktop window managers. Choice, after all, is one of the great joys of running Linux.
Quoi? Which one am I running? All of those and a half-dozen more, mon ami. François, I am not pulling your leg. My main desktop is KDE, but over here I have GNOME and over there XFCE, and in that virtual desktop, I have Window Maker. Furthermore, I have IceWM running in my Window Maker session. No, mon ami, it is not complicated at all, and I will show you how it is done as soon as our guests arrive. But they are already here! François! Vite! To the wine cellar. Given that today's menu is more dessert than meal, fetch the 2001 Niagara Peninsula Riesling ice wine and bring it back tout de suite!
Welcome, mes amis, to Chez Marcel. Please sit and make yourselves comfortable. I have been pushing my faithful waiter to experiment with different desktops. It's always nice to try something different, which is why we change the menu from time to time, non? The same is true for your desktop environment. KDE or GNOME may be your favorite, but why not try Window Maker, IceWM or XFCE for a change? A little visit to Matt Chapman's Window Managers for X Web site at www.plig.org/xwinman should whet your alternative window manager appetite. In fact, why not try them while you are still running your favorite desktop? Non, mes amis, I have not been oversampling the wine. It is possible to run multiple desktops simultaneously, and it is a lot of fun once you get the hang of it.
As with many things in the Open Source world, there is certainly more than one way to do it. The first involves jumping out of your current X session back to one of your virtual terminals. If you already are running an X session, press Ctrl-Alt-F1 and you should find yourself back at a text screen. Incidentally, F1 just as easily could be F2, F3, F4, F5 or F6. If you started X from the command line (as opposed to using a login manager like gdm or kdm), you should see the dialog for the session when you press Ctrl-Alt-F1 with the log output from X on your screen. Any of the other function keys, F2–F6, should provide you with a text-based login screen. Simply press Ctrl-Alt-F2 for virtual terminal two and so on.
Your graphical session is still active. It runs by default on what the system calls display :0, something you can verify by typing the command echo $DISPLAY at a shell prompt (inside your graphical session, of course). You should see your PC's hostname with the display suffix. Press Ctrl-Alt-F7 to go back to your KDE, GNOME or whatever session. Go ahead and try it, and then head on back to a text screen (Ctrl-Alt-F?). Your X session, then, is on virtual terminal seven. From the text screen, log in as yourself and type the following:
xinit /usr/X11R6/bin/xterm -- :1
Notice the -- :1 at the end of this line. Because X already is running on display :0, we need to run this X terminal on an alternate display, in this case, :1. Now a new X session begins, this one running on virtual terminal eight. It looks pretty boring because all you have is a simple X terminal running on a gray background. There isn't much to look at or even any way to move the X terminal window around, but you can execute commands and even start up other X programs, which you also won't be able to move around. To go from your new session to the old, press Ctrl-Alt-F7, then Ctrl-Alt-F8 to get back to your X terminal. Easy, non? Using this technique, you could start something more interesting, like another window manager, such as IceWM or XFCE, and happily switch back and forth from one virtual X session to another.
To get out of that X session, you should know about the classic X window escape hatch, what I call the “oh, mon Dieu, I've tried everything and I can't get out of X” escape clause. Simply press Ctrl-Alt-Backspace. This is, mes amis, a rather rude way to exit X and should be used only when no other options are available.
Switching from one X session to another is fine, but doing this makes it hard to continue working on two desktops. To avoid constantly switching back and forth, I have been running a program called Xnest. Xnest, part of the XFree86 distribution, is interesting because it is both an X client and server all in one. It literally is a nested X server. Before I continue, I probably should let you know that although it is part of X, it may not be installed already on your system; however, the package (XFree86-Xnest) is likely on your distribution CDs.
In order to start a nested server, you have to provide an alternative DISPLAY variable, as we did with the X terminal earlier. Because your own X server is probably running as :0, choose :1. To make sure you can connect to this new server from any of your applications, use the -ac option as well. This option disables access controls. The ampersand starts my new server as a background process:
Xnest :1 -ac &
Now, a blank window starts on your desktop with the basic X cursor in the center. On my Mandrake system, it was a dark-blue square. On another server running Red Hat, it was black. It doesn't look like much, so let's start an X application on our new server. We start with something simple like our venerable Xclock:
xclock -display :1
When you press Enter, the classic Xclock appears in your second X server window. This also is a great way to play with things like X resources. For instance, let's dress up that rather boring clock and move it to another part of the display:
xclock -foreground "Red" \ -geometry +450+250 -display :1
One by one, you could populate this new server with applications—the X logo here and an Eterm there. Of course, moving windows around isn't possible in this environment, thereby making this idea only so useful. To experience the flavor of desktop mania truly, you need the whole smörgåsbord, meaning a window manager and, of course, a little more wine to go with it.
Starting a full-blown window manager is a similar process, and for this next step we start with the basic Tabbed Window Manager (TWM). This is the most basic window manager you have and comes as part of XFree86. Begin by closing the applications in your Xnest so you can start clean. You should be looking at that blank square with the X cursor in the center. Now, from the command line, type:
twm -display :1
If nothing changes, press the left mouse button and TWM's menu should appear. I did say it was a basic window manager, non? Let's try running Window Maker this time:
wmaker -display :1
As you can see, the format essentially is the same, passing the -display parameter to the window manager's command name in each case. This is, of course, where I should tell you that not every window manager uses the same switch. Here's a list of the more popular window managers and what you need to start them:
Motif Window Manager: mwm -display :1
F Virtual Window Manager: fvwm2 -display :1
GNOME (note double hyphen): gnome-session --display :1
AfterStep: afterstep -d :1
In some cases, you won't be able to start a window manager using some kind of display redirect switch. This is true with KDE, AmiWM, XFCE and some others. To run these window managers, begin with a simple X terminal in your nested X server:
xterm -display :1
- Sony Settles in Linux Battle
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Profiles and RC Files
- Maru OS Brings Debian to Your Phone
- Understanding Ceph and Its Place in the Market
- Snappy Moves to New Platforms
- What's Our Next Fight?
- Git 2.9 Released
- The Giant Zero, Part 0.x
- Astronomy for KDE