This ain't your grandparents' desktop! Oh wait ...

Window Shopping


Come along and take a tour of several desktop environments and window managers available for Linux.

By Marcel Gagné

Studio Porto Sabbia, 123rf

I am going to start this column with a little wager. I will bet a week of Linus Torvalds' salary that the vast majority of Linux desktop users are using either KDE or Gnome. I'll even give you 52 to 1 odds. A whole year's worth.

Okay, so that's a bit of a sucker bet. Most people do in fact run either KDE or Gnome, but although these are the most popular desktop environments, they aren't the only ones. Both are beautiful, mature, and powerful, combining advanced window management with a suite of applications that integrate seamlessly into the desktop. An army of developers works on the desktop environment and the countless applications written for them.

KDE is currently version 4.4, and Gnome is moving toward its 3.0 release.

Gnome Shell

Speaking of Gnome 3.0, although the next incarnation isn't here yet, you can download the Gnome Shell [1], which is a sneak peek at where Gnome is heading in terms of the Linux desktop (Figure 1). To use the Gnome Shell over an existing, running Gnome session, run the following command:

gnome-shell --replace

While in the Gnome shell, just move your mouse into the right-hand corner of the desktop to open up the workspace controls on the left-hand side of your screen. Next, you can start programs, visit defined places, peruse or open recent documents, and launch programs. To the left are your workspaces, presented in a KDE 4.4 and Plasma-style format (although KDE has virtual desktops within workspaces). A plus sign inside a gray circle floats below and to the right of your last workspace. To add workspaces, click the plus sign and open applications in those workspaces. To zoom to the workspace you want, click on it. It will expand to fit your screen.

Figure 1: The Gnome Shell offers a sneak peak at Gnome 3.0. It's the future of Gnome, baby!

Window Managers and Desktop Environments

For many, KDE and Gnome represent the pinnacle of desktop evolution, and rightly so. So why look elsewhere? For one thing, not everyone works the same way. KDE and Gnome also tend to be resource intensive; this is not a big deal for today's computer systems but can be too much for older systems with limited resources. Those insanely popular netbooks often come with different window managers for precisely these reasons.

Before I show you some tricks for trying out various window managers and desktop environments, I apologize if I don't cover a favorite window manager because of space and time constraints. Telling you about every window manager out there is akin to mapping the galaxy. Doable, given enough time and money, but you're talking a lot of time.

Starting from X

So, how do you run all these other window managers while continuing to run KDE or Gnome? As with many things in the open source world, you have more than one way to do it. The first way involves jumping out of your current X session back to one of your virtual terminals. If you are running an X session, press Ctrl+Alt+F1 to get back to a text screen. Cool? Incidentally, F1 could just as easily 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'll probably 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 as well. Just press Ctrl+Alt+F2 for virtual terminal 2 and so on.

Log in to any of those text session, then type the following:

xinit /usr/bin/xterm -- :1

The result is a plain old xterm running on a black background. Your current graphical session is still active, by the way. It runs by default on what the system calls display :0 (or :0.0), something you can verify by typing echo $DISPLAY at a shell prompt (inside your graphical session, of course). Press Ctrl+Alt+F7, and you're back to your KDE, Gnome, or whatever session. To return to a text screen, press Ctrl+Alt+Fn. Your X session, then, is on virtual terminal 7.

Notice the - :1 at the end of that command line. Because X is already running on display :0, you need to run this X terminal on an alternate display, in this case, :1. A new X session will begin, and this one will run on virtual terminal 9 (depending on the way your system is set up, the first session might be on F8). It looks pretty boring, because all you will 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. That's what window managers are for.

Xfce

From that command prompt, you could start a window manager or desktop environment session:

xfce4-session

Now you are running Xfce4 (Figure 2), a lightweight desktop environment that is quite popular as an alternative to the larger, more demanding rulers of the desktop world (KDE and Gnome). Xfce4 [2] is fast and easy on your system resources. It's also very mature with a large installed base.

Those of you who are fans of Ubuntu, Kubuntu, and all the other *buntus out there will no doubt be familiar with Xubuntu. Whereas Ubuntu uses Gnome and Kubuntu uses KDE, Xubuntu is built on Xfce4. If you are running Ubuntu, you can install Xfce4 with all the trimmings by installing the xubuntu-desktop package. Xfce is also the desktop environment of choice for other distributions like Zenwalk, Dreamlinux, and others.

To launch another desktop session without going to a text screen, running xinit, and so on, click the program launcher (if you are running KDE), cursor over to the Leave menu, and select Switch User: Start a parallel session as a different user.

The session you log in to will occupy the next virtual terminal in much the same way as it did when you started an X session manually. It's a much cleaner and friendlier way to do it, and handy if you have other people at home using the same computer. Nevertheless, it can be a pain to work on two desktops, switching from X session to another.

Figure 2: Xfce4 is possibly the most popular of the lightweight desktop environments.

Xephyr

To avoid this constant switching back and forth, I have been running a program called Xephyr. Xephyr is a superb tool that allows you to run a nested X session on your desktop, such as an additional desktop, without having to run a complete virtual machine.

To start this nested session, you have to provide an alternative DISPLAY variable as I did with the X terminal earlier on. Because your own X server is more than likely running as :0, enter:

Xephyr -ac -screen 1200x675 :1

A blank window will start on your desktop with the basic X cursor in the center. Then you could start a window manager session in a terminal window. For instance, to run Window Maker [3], an older favorite of mine, enter:

wmaker -display :1

Window Maker (Figure 3) is a window manager built to mimic the NeXTStep user interface from NeXT Computer, a company founded by Steve Jobs after he was fired from Apple many years ago. The environment has some rather cool features. A clip in the top left-hand corner lets you switch from one workspace to another. Right-clicking anywhere on the desktop brings up a menu of applications. On the right, you'll see an application dock, where you can run so-called dock apps. These are little self-contained applications that do all sorts of wonderful things: system monitors of every kind, clocks, lunar apps, and apps that report on solar activity to name a few. You can think of them as precursors to today's desktop widgets.

Figure 3: Window Maker is designed to mimic the NeXTStep user interface.

If you enjoy the Window Maker experience, complete with its dockable applications, consider checking out AfterStep as well.

You can do this with a larger number of graphical applications. Just run the program and tell it what display you want to run it on. Other desktop environments and window managers work as well. Listing 1 shows a sample of how some programs can be started on these remote displays.

After you've played with several window managers in this way, you might find yourself faced with a bit of a roadblock. Sometimes you can run into the message:

xfce4-session: Another session manager is already running

If you know this isn't the case, you can find out where the SESSION_MANAGER variable points to with:

$ echo $SESSION_MANAGER
local/aceshigh:@/tmp/.ICE-unix/3934,unix/aceshigh:/tmp/.ICE-unix/3934

As you can see, I had leftover session information from a previous run with a nested window manager. One option is to unset the SESSION_MANAGER variable. The second is simply to remove the troubling files (assuming, of course, that you are no longer running your window manager).

$ rm /tmp/.ICE-unix/3934

Nothing's wrong with starting these window managers from a command line and specifying the display of the Xephyr nested server, but you have a somewhat more elegant way of achieving this called Xdmcp, and it allows you to run the login manager on another display, or on another workstation entirely. Displays are, in essence, other screens where you can log in, work, and run programs. Because Xdmcp is turned off by default, you need to activate it. The file that controls the login manager for KDE is /etc/kde4/kdm/kdmrc, and that's where you'll find a reference to Xdmcp.

Listing 1: AfterStep
01 afterstep -d :1
02    # Afterstep window manager
03 xclock -background "Red" -display :1
04    # Yes, it's a clock, with a red background
05 fvwm2 -display :1
06    #F Virtual Window Manager
07 gnome-session --display :1
08    # Gnome (note double hyphen)
09 awesome -d :1
10    # Awesome window manager

XDM, KDM, and GDM

Log out and restart your X server so that the new changes take effect. By passing -query ip_address (the IP address of your computer) to Xephyr, you can call up another login manager session. However, you would likely find yourself looking at a flat gray screen with an X in the center. Although you can move that X around, it isn't very interesting. That's because XDMCP access to your login manager is usually turned off by default and therefore requires a little bit of tweaking.

KDE uses a kdmrc file. On my system, it is located in /etc/kde/kdm. Look for the following lines and make sure that the Enable parameter in the [Xdmcp] section is set to true:

[Xdmcp]
# Whether KDM should listen to incoming XDMCP requests.
# Default is true
Enable=true

For those using GDM, the Gnome login manager, the file you need to edit is /etc/gdm/gdm.conf; the only difference is that the Xdmcp section is all lowercase ([xdmcp]).

You should also edit the Xaccess file. Look for the following line:

* #any host can get a login window

The line will likely have a comment mark before it (the # sign). Remove it, save the file, then restart your display manager by logging out. Once you are logged back in, you can restart Xephyr with the -query flag. Here's how it will look now:

Xephyr -ac -screen 1200x675 -query 127.0.0.1 :1

Immediately after adding -query, you need to specify the host IP address you are connecting to.

To run multiple X sessions on your desktop (:1, :2, :3, etc.), make sure you specify 127.0.0.1, as above, and not localhost. The result is a Xephyr window with your login manager and a list of the various desktop environments and window managers you have installed (Figure 4).

Figure 4: Pressing the Down arrow in KDM now shows many different session types from the window managers I've installed.

Desktop Abundance

At this point, I went ahead and installed a number of different window managers and desktop environments:

sudo apt-get install fluxbox awesome openbox windowmaker ratpoison fvwm-crystal

and so on. Once you start doing this, it's easy to get hooked. Also, it's easy to see some great alternatives to your desktop environment that you might not have considered.

One of the first really popular window managers for Linux was FVWM (F virtual window manager), which was the inspiration for many others to follow. I might want to change that last "was" to "is," because FVWM is still very much in development with an active community behind it. Nevertheless, it does show its age, and projects like FVWM Crystal (see Figure 5) have really spiced up the classic looks of FVWM.

Figure 5: Another great update to an old window manager, FVWM Crystal.

One might argue that the resource-friendly desktop is by and large the reason for the continued existence, and continued development, of some of these window managers. For instance, consider the Fluxbox [4] window manager, which is shown in Figure 6.

Figure 6: Fluxbox is based on Blackbox and is the inspiration for Openbox.

One window manager that's a little more up to date and actively developed is Openbox [5], which is based on Fluxbox, which, as I mentioned, was based on Blackbox. Openbox, like Fluxbox, is a minimalist window manager providing one of the smallest footprints in terms of memory and processor use.

In the world of minimalist window managers, there seems to be an unspoken competition to see who can create the smallest, most efficient, and sometimes most austere window manager around. Contenders for this award include awesome [6] (yes, that's what it's called) and xmonad [7]. If minimizing your desktop footprint is your ultimate goal, then try these out. Just be prepared for a little more work and a bit more tweaking to get things just right.

I'm going to wrap this up with a little balance. Somewhere between the powerful but demanding leaders in the world of desktop environments and the minimalists that barely cause a resource blip, there's room for moderation. LXDE [8], the Lightweight X11 Desktop Environment fits in here very nicely (Figure 7).

Figure 7: LXDE: Who says light and fast can't look good, too?

What I've covered today is far from a complete list. Some desktop environments and window managers that you've probably never heard of, despite not being the flashiest creations around, are nevertheless very interesting, usable, flexible, and deserving of your consideration. Some are so obscure that only the developer and a few close friends are running them.

This is the open source world, after all, and people are not only free to work the way they want to, they are free to create the tools that let them work the way they want to. Those tools can and do go right down to the X desktop level itself. When you've got open source, you've got choice. And choice is, after all, one of the great joys of running Linux. If nothing else, you'll have some fun exploring the many possible faces of the Linux desktop.

INFO
[1] Gnome Shell: http://live.gnome.org/GnomeShell
[2] Xfce4: http://www.xfce.org/
[3] Window Maker: http://windowmaker.org/
[4] Fluxbox: http://fluxbox.org/
[5] Openbox: http://openbox.org/
[6] awesome: http://awesome.naquadah.org/
[7] xmonad: http://xmonad.org/
[8] LXDE: http://lxde.org/