Red Hat® Linux 6 Unleashed

ContentsIndex

Chapter 5: Window Managers

Previous ChapterNext Chapter

Sections in this Chapter:

 

Chapter 5
Window Managers

by Bill Ball


This chapter covers a variety of window managers for the X Window System. As you learned in Chapter 4, "Configuring the X Window System, Version 11," X11 provides the basic networking protocols and drawing primitives used to build the platform for various graphical interfaces, or window managers, you can use with Linux. You'll find a wealth of different clients, or programs, for X included on this book's CD-ROM, including many of the window managers discussed in this chapter. A number of these clients, such as twm, are from the XFree86 distribution, while others, such as Carsten Haitzler's GNOME-enabled Enlightenment window manager, use additional clients developed with support by Red Hat Software, Inc. to provide a complete desktop environment. Also included is the K Desktop Environment (KDE), a similar and slightly more mature desktop distribution with features and a following that rivals the commercial Common Desktop Environment (CDE).

What Is a Window Manager?

Using Linux and the XFree86 distribution of X11 means freedom of choice--the choice of an operating system and the choice of how you'd like your computer's desktop or root window in X to look. Although a window manager is nothing more than an X11 client, you'll find that using a window manager is virtually necessary if you want to run different programs, drag windows around the display, use icons, create virtual desktops, resize windows, or customize how your X sessions work. Of course, you can run X without a window manager, but you'll lose a lot of functionality.

Note - Want to try X without a window manager? If you've configured Red Hat Linux to use a display manager, such as the GNOME display manager, gdm, select the Failsafe session. If you don't use an X display manager (such as gdm, kdm, or xdm), create an .xinitrc file in your home directory with your favorite text editor and then enter just one line:

exec xterm

When X starts (or you use startx), you'll get an xterm window, as shown in Figure 5.1--but you won't be able to move or resize it. To quit your X session, either type the word exit at the command line of the xterm terminal window or use the Ctrl+Alt+Backspace key combination to kill your X session. Without a window manager to provide support for movable windows, you're pretty much stuck with a static xterm screen. Now do you see why window managers are so much fun (and necessary)?


FIGURE 5.1
You can run X11 without a window manager, but is it worth it?

Red Hat Linux comes with several window managers for X. Some window managers are part of the XFree86 X11 distribution, while others are supported by Red Hat for your use. This chapter starts by discussing the GNOME software libraries for X11, then concentrates on the default window manager, Enlightenment, introduces you to KDE, and wraps up with XFree86 window managers.

The GNOME X Environment


This section covers GNOME, the GNU Network Object Model Environment, which is supported by and is being developed by programmers from Red Hat Software, Inc., and others around the world. GNOME has received an increasing interest because it is distributed under the GNU GPL, unlike the underlying graphics software libraries, Qt, for KDE. Arguments about licensing constraints aside, GNOME is an important part of the future of the graphical X desktop for Linux for a number of reasons:

What Is GNOME?

GNOME is a set of software libraries and X11 clients built to support an X11 desktop environment. GNOME can be used with any GNOME-aware window manager or any window manager that will support its panel component and client features, such as drag-and-drop desktop actions. GNOME is initialized and runs before you start your window manager. Like KDE, GNOME provides a rich user environment with application frameworks, a file manager, a panel, a suite of applications with consistent look and feel, and session management, so that a working desktop is restored between X11 sessions.

GNOME Installation Components

GNOME consists of a number of software components and, for Red Hat Linux, is distributed in a series of RPM files. You can install GNOME using the glint control-panel X11 client or through the rpm command. The current distribution of GNOME at the time of this writing consists of the following files, as shown in Table 5.1.

TABLE 5.1  GNOME Components

RPM File

Description

control-center-1.0.5

GNOME desktop control utility

control-center-devel-1.0.5

Development libraries to build GNOME capplets

ee-0.3.8

Electric Eyes image viewer

gdm-1.0.0

The GNOME display managers (similar to the kdm and xdm clients)

gedit-0.5.1

A GNOME-enabled text editor

gedit-devel-0.5.1

Libraries to support building plug-ins for the gedit client

gmc-4.5.30

The GNOME Midnight Commander

gnome-audio-1.0.0-6

Sounds for GNOME events

gnome-audio-extra-1.0.0-6

GNOME sounds

gnome-core-1.0.4-34

Thirty basic GNOME applets (programs)

gnome-core-devel-1.0.4-34

Software libraries for GNOME panel development

gnome-games-1.0.2-10

More than a dozen GNOME games

gnome-games-devel-1.0.1-1

Minimal game development libraries

gnome-libs-1.0.8-8

Required software libraries

gnome-libs-devel-1.0.8-8

GNOME software development libraries

gnome-linuxconf-0.22-1

GNOME interface for linuxconf

gnome-media-1.0.1-3

GNOME-aware multimedia clients, such as a music CD player, mixer

gnome-objc-1.0.2-4

Support libraries for GNOME Objective C clients

gnome-objc-devel-1.0.2-4

Programming libraries for GNOME Objective C clients

gnome-pim-1.0.7-2

Personal information manager clients, such as gnomecal and gnomecard

gnome-pim-devel-1.0.7-2

Development support for the GNOME PIM clients

gnome-users-guide-1.0.5-4rh

Contains the GNOME users' guide

gnome-utils-1.0.1-6

At least 20 different GNOME clients, such as an editor, calculator, and other clients

gnorpm-0.8

A GNOME-enabled front-end client to version 3.0 of the rpm command

gnumeric-0.23

A GNOME-enabled simple spreadsheet client

gtop-1.0.1

A GNOME-enabled system monitor

pygnome-1.0.1

Python extension modules that provide GNOME support


The majority of the GNOME-specific clients for X11 are installed under the /usr/bin directory when you install Red Hat Linux. Systemwide configuration and support files will be installed under the /usr/share/gnome directory, but you may also find other GNOME client directories (such as those for gedit, gnibbles, or gnotepad+) under /usr/share.

If you'd like to get the latest software libraries, GNOME distribution, and the GNOME FAQ, or download the newest GNOME applications, you can find them at http://www.gnome.org.

Configuring X11 to Use the GNOME or Other Display Managers

The GNOME distribution of X11 clients and software libraries does not include a window manager. GNOME libraries and clients, such as the panel application, are designed to work with your favorite X11 window manager.

If you install Red Hat Linux, configure an XFree86 X11 server to work with your computer's graphics card, and choose to boot directly to X, you'll end up using the Enlightenment window manager with the GNOME libraries by default. Your login will be through the GNOME display manager, gdm (as shown in Figure 5.2). However, Red Hat Linux comes with other display managers, such as the K display manager (kdm), and the X display manager (xdm).

Initially you may think that the default display manager launched at startup would be according to a symbolic link named prefdm under the /etc/X11 directory. If you look at the runlevel entry for runlevel 5 in your Red Hat 6.0 system initialization table, the file /etc/inittab shows this:

x:5:respawn:/etc/X11/prefdm -nodaemon

FIGURE 5.2
The GNOME gdm display manager is the default graphical login for Red Hat Linux 6.0 when booting directly to X11.

When you examine the prefdm file under the /etc/X11 directory, you'll see this:

lrwxrwxrwx   1 root  root    17 May  8 11:57 /etc/X11/prefdm -> ../../usr/bin/gdm

You may think, according to this example, that the default display manager is gdm. You may think all you have to do to change the default display manager is delete the prefdm file and then use the ln command to create a new symbolic link named prefdm, which points to xdm or kdm. This is not the case!

The prefdm symbolic link is created during boot up by the rc.sysinit script, found under /etc/rc.d. This script contains logic to determine the default display manager when booting. The pertinent portion of the rc.sysinit script looks like this:

# Set preferred X display manager link
preferred=
if [ -f /etc/sysconfig/desktop ]; then
        if [ -n "´grep GNOME /etc/sysconfig/desktop´" ]; then
                preferred=gdm
        elif [ -n "´grep KDE /etc/sysconfig/desktop´" ]; then
                preferred=kdm
        elif [ -n "´grep AnotherLevel /etc/sysconfig/desktop´" ]; then
                preferred=xdm
        fi
fi  

As you can see, rc.sysinit first looks for a filename desktop under the /etc/sysconfig directory. To set the default display manager, create the desktop file under /etc/sysconfig, then enter a keyword such as GNOME, KDE, or AnotherLevel. If you further examine the rc.sysinit script, you'll see it then creates the prefdm link like this:

if [ -n "$preferred" ] && which $preferred >/dev/null 2>&1; then
        ln -snf ../..´which $preferred´ /etc/X11/prefdm
else
        if [ ! -L /etc/X11/prefdm ]; then
                if which gdm >/dev/null 2>&1; then
                        ln -snf ../..´which gdm´ /etc/X11/prefdm
                elif which kdm >/dev/null 2>&1; then
                        ln -snf ../..´which kdm´ /etc/X11/prefdm
                elif which xdm >/dev/null 2>&1; then
                        ln -snf ../..´which xdm´ /etc/X11/prefdm
                fi
        fi
fi  

The default Session, or type of window manager launched by the gdm display manager, is defined in the /etc/X11/gdm directory. If you examine the Sessions directory under /etc/X11/gdm, you'll see this:

AnotherLevel  Default  Failsafe  Gnome  KDE  default 

Most of these files are short shell scripts and show up under the Sessions drop-down menu in the gdm dialog box. The scripts use the Xsession command, found under the /etc/X11/xdm directory, to start a particular X session. For example, the AnotherLevel session script contains:

#!/bin/bash -login
/etc/X11/xdm/Xsession anotherlevel

If you examine the Xsession script, you'll find this section:

case $# in
1)
    case $1 in
    failsafe)
        exec xterm -geometry 80x24-0-0
        ;;
    gnome)
        exec gnome-session
        ;;
    kde)
        exec startkde
        ;;
    anotherlevel)
        # we assume that switchdesk is installed.
        exec /usr/share/apps/switchdesk/Xclients.anotherlevel
        ;;
    esac
esac  

This shows the different commands used to start your X session after selection through a display manager. Note that the Failsafe session only launches the xterm client.

Note - For more information about shell scripts and shell programming, see Chapter 25, "Shell Programming."


If you do not use a display manager to log into Red Hat Linux and, for example, want to use GNOME for your X session, your .xinitrc should contain the following entry:

exec gnome-session

You would then use the startx command to start your X session:

# startx

The session will start the major GNOME components, such as the panel (a taskbar client from which to access root menus, configure your desktop, or launch X11 clients), along with desktop, keyboard, and mouse control software. Finally, the Enlightenment window manager is launched. Figure 5.3 shows what your X11 desktop might look like with several clients running.

FIGURE 5.3
The X11 desktop using the GNOME environment uses a panel, and nearly all clients provide common features, such as menus and toolbars.

Using GNOME Clients and Tools

The most obvious and first GNOME client you'll see is the panel client, which offers a taskbar at the bottom of your X desktop. From the root menu of the taskbar (displayed by pressing the left mouse button, or mouse button 1 on the GNOME button), you can launch a variety of other GNOME clients:

Applications

Editors, browsers, and productivity clients, such as gnomecard or the Gnumeric spreadsheet

Games

Such as Mah-jongg, Yahtzee, Mines

Graphics

Editors, such as Electric Eyes or the GIMP

Internet

FTP, electronic mail, and other clients, such as Netscape

Multimedia

Audio CD players, mixers and sound utilities

System

Change password, finger information, manage software

Settings

Wallpaper or screen saver settings, mouse handling, keyboard configuration, session management, menu editing, and general desktop controls

Utilities

Various terminal clients and system utilities

File Manager

The GNU Midnight Commander, a graphic desktop file manager

Help

To get help on GNOME

Run Program

A command-line dialog box

AnotherLevel Menus

A submenu system from other window managers that includes traditional X11 clients

KDE Menus

A submenu system providing access to KDE clients

Panel

The panel's configuration and control menu

Lock Screen

To lock (password protect) the desktop

About

About the GNOME Panel dialog box

About GNOME

About GNOME dialog box

Log Out

To end your X11 session


Because many of the GNOME clients are installed in the Linux file system in the normal places (such as the /bin, /usr/bin, or /usr/X11R6/bin directories), you can also start them from the command line of an X11 terminal window. You'll quickly recognize a GNOME client because most clients follow the GNOME style guide. This guide stipulates that each program should have supporting documentation and each client should have a File and Help menu, with an Exit menu item on the File menu and an About menu item on the Help menu (see Figure 5.4).

FIGURE 5.4
GNOME clients, such as the gEdit editor, generally have a consistent interface with a standard menu and toolbar.

Other features in common among many GNOME clients include tear-off menus and toolbars. To tear off a menu bar, click and drag the mottled, vertical rectangle on the left end of the menu bar. The bar will drag with your mouse pointer. You can use this approach to rearrange the order of the controls of a GNOME client (such as placing the menubar of a terminal at the bottom of the terminal window), or placing controls as floating tool windows beside a client's window. Each client will remember the toolbar or menu bar settings between launches.

Configuring Your Desktop with the GNOME Control Center

The GNOME Control Center, shown in Figure 5.5, configures your system and desktop. The Control Center can be started by clicking the GNOME Configuration tool button on the desktop panel, or by clicking the panel menu, selecting Settings, and then clicking the GNOME Control Center menu item.

For example, to configure your desktop's background, launch the Control Center and then click the Background item, or capplet, under the Desktop group in the left side of the Control Center's window. The right side of the Control Center will clear, and you'll have access to a dialog box (as shown in Figure 5.5) to configure your desktop's background color or wallpaper.

FIGURE 5.5
Use the GNOME Control Center to configure your system and session's desktop.

You can radically change your desktop's appearance by selecting other controls, such as the Theme Selector. The GNOME libraries included with Red Hat Linux 6.0 offer 11 different themes, or color and decoration schemes you can use with the currently running window manager. Another way to alter your desktop is to change the current window manager on-the-fly through the Window Manager capplet.

By default, only Enlightenment and Window Maker are included as alternative window managers. However, you can add others, such as the AnotherLevel configuration of fvwm2, AfterStep, fvwm, or twm. Start the Control Center, then click the Window Manager capplet. In the Window Manager dialog box (as shown in Figure 5.6), click the Add button and then type in the name of the window manager in the Name field. Next, type in the complete pathname and command line used to run the window manager in the Command field. If the window manager has a configuration tool, enter the complete pathname and necessary command-line options to the Configuration Command field. Do not click the Window Manager Is Session Managed button unless you are absolutely sure that the window manager is GNOME-aware. When finished, click the OK button.

You can then try your new choice by highlighting the name of the new window manager and clicking the Try button in the Window Manager dialog box.

FIGURE 5.6
The Window Manager capplet in the GNOME Control Center may be used to switch window managers on-the-fly, or even add new window manager choices.

Note - The GNOME Control Center houses many types of desktop settings in one convenient dialog box, but you should know that you can also launch the individual settings capplets from the Settings menu on the GNOME desktop. These capplets (and other clients) cover desktop, sound, keyboard, and mouse settings, along with menu editing of the GNOME panel.

GNOME Panel Configuration

The GNOME Panel is an application and menu launcher for the GNOME desktop. By default, the panel is home for a number of important desktop elements, such as

The panel is configured by clicking the Panel menu item on the panel's pop-up menu, or by right-clicking a blank area of the panel. The pop-up Panel menu, shown in Figure 5.7, offers a choice of 10 different configuration settings. You can create new panels on the top, bottom, left, or right edges of the display, and add or remove menus, drawers (to contain launcher applets), icons, or other applications. If you need a bit more screen real estate, click the Hide Panel button on either end of the panel to minimize or maximize the panel.

FIGURE 5.7
The Panel menu configures the appearance, contents, and location of your GNOME desktop's panel.

Launcher applets may be added to the panel in at least two ways. One way is to use GNOME's drag-and-drop. Use the GNU Midnight Commander to navigate to a directory containing various commands, such as /usr/bin. Next, drag an icon of a command, such as e-conf from the icon view window and drop the command directly on your desktop's panel. The Create Launcher applet appears, as shown in Figure 5.8.

Type in a name for the command as well as a short comment. If the command usually runs inside a terminal window or from the console, click the Run in Terminal button. You can also assign an icon if you click the Icon button; a visual directory of the /usr/share/pixmap directory will appear. When finished, click the OK button. A new icon will appear on your panel.

Panel elements such as icons can be changed, moved, or removed directly on the panel. Right-click an element and a small pop-up menu appears with several selections.

FIGURE 5.8
The Create Launcher applet dialog box is a handy way to create customized applications (with icons) for your GNOME desktop's panel.

Red Hat® Linux 6 Unleashed

ContentsIndex

Chapter 5: Window Managers

Previous ChapterNext Chapter

Sections in this Chapter: