X is the standard graphical user interface (GUI) for Linux. Like other GUIs, such as Windows and Mac OS, X lets you interact with programs by using a mouse (or other pointing device) to point and click, providing a simple means of communicating with your computer.
Despite its age, X is a remarkable and very modern software system offering a cross-platform, network-oriented GUI. It runs on a wide variety of platforms including essentially every flavor of Unix, such as Solaris, Linux, and the BSDs (FreeBSD, NetBSD, and OpenBSD). X clients are available for use, for example, under Windows 3.x, 9x, NT, 2000, and XP. The sophisticated networking capabilities of X let you run a program on one computer while viewing the graphical output on another computer via a network connection. X was designed to provide room for experimentation with new interfaces and so a variety of X-based window managers and desktops is available. On the other hand, this variety can provoke some minor confusion as interfaces and behaviors vary slightly from one system to another.
Most Linux users run XFree86, a freely available software system compatible with X, which is distributed with Red Hat Linux. XFree86 was developed by the XFree86 software team, which began work in 1992. In 1994, the XFree86 Project, Inc. (http://www.xfree86.org) assumed responsibility for ongoing research and development of XFree86.
Using X means interacting with Linux on several different levels. X itself merely provides the graphics facility for displaying components of a GUI: X draws the screen, draws objects on the screen, and tracks user input actions such as keyboard input and mouse operations. To organize the desktop into familiar objects like windows, menus, and scrollbars, X relies on a separate program called a window manager. But even more functionality is required. A window manager alone doesn't provide tight integration between applications of the sort required by drag-and-drop operations; that higher degree of integration comes from what's called a desktop environment. While X itself is a single program, X under Linux supports several popular window managers and two popular desktop environments, GNOME and KDE.
Window managers create the borders, icons, and menus that provide a simple-to-use interface. Window managers also control the look and feel of X, letting you configure X to operate almost any way you desire. At one time, it was common for Linux users to separately choose a window manager and desktop environment. However, today most users retain the window manager with which their preferred desktop environment is initially configured. GNOME uses the metacity window manager and KDE uses Kwin, formerly known as the K Window Manager, or simply K. Because of the variety of window managers, scrollbars and other widgets may behave differently from one system to another. But, the differences are minor and determined clicking generally discovers the proper method of interacting with a widget. See Section 18.104.22.168 later in this chapter.
A desktop environment is a set of desktop tools and applications. The Windows desktop includes applications such as the Windows Explorer, accessories such as Notepad, games such as FreeCell and Minesweeper, and utilities such as the Control Panel and its applets. Although you can run X without a desktop, having a desktop helps you work more efficiently. Both GNOME and KDE are free software and are developed by teams in an open, collaborative manner.
The default Red Hat Linux desktop environment is GNOME. However, you can easily reconfigure KDE as the desktop, if you prefer. The choice between GNOME and KDE is now not so important as in the past. Red Hat has reworked GNOME and KDE to give them a consistent look and feel. Moreover, almost every GNOME application can now be run under KDE and almost every KDE application can now be run under GNOME. So your Linux experience will be similar whether you're using GNOME or KDE.
GNOME stands for the GNU Network Object Model Environment (pronounced as guh-nome or gee-nome). One of GNOME's most interesting features is session awareness. When you re-enter GNOME after logging out, it reconfigures your desktop to match the state at the time you exited by launching each application that was open when you exited. GNOME even restores each application to its former state by, for example, moving to the page that was open when you exited.
Both GNOME and KDE support a myriad of standard and optional desktop tools and applications, such as:
Games and amusements such as freecell, gnibbles, gnobots, gnomine, mahjongg, and sol
The GNU Image Manipulation Program (GIMP)
Ghostview, which lets you view PostScript files and print them on non-PostScript printers
Internet applications such as Mozilla, gFTP, NcFTP, X-Chat, slrn, and pine
Multimedia applications such as Audio Player, Sound Mixer, and CD Player
General applications such as gEdit, a text editor; Mozilla, the popular open source web browser; and OpenOffice, a desktop suite featuring word processing, spreadsheets, presentations, and other facilities
Utilities for configuring and using your Red Hat Linux system
KDE (the K Desktop Environment) includes Kwin, the K Window Manager, as an integral component. KDE provides a file manager, a help system, a configuration utility, and a variety of accessories and applications, such as:
Games such as kasteriods, kmines, and kpoke
Graphical applications such as Kfract, a fractal generator; and Kview, an image viewer
Multimedia applications such as Kmix, a sound mixer; and KsCD, a CD player
Network applications such as Kmail, a mail client; gaim, an instant messenger compatible with AOL's AIM; and KNewsticker, an applet that displays news from web sites of your choice
As with GNOME, new KDE accessories and applications are available almost weekly.
Using the keyboard with X closely resembles using the keyboard with Windows. X sends your keyboard input to the active window, which is said to have the input focus. The active window is usually the window in which you most recently clicked the mouse.
While Windows lets you choose to perform most operations by using the keyboard or mouse, X was designed for use with a mouse. If your mouse isn't functioning, you'll find it quite challenging or even impossible to use most X programs. X allows you to perform only a few important functions via the keyboard:
Switching video modes
Using virtual consoles
Abruptly terminating X
When you configured X, you specified the video modes in which X can operate. Recall that the current video mode determines the resolution and color depth of the image displayed by your monitor?for example, 16 bits per pixel color depth and 1024x768 pixels screen resolution.
By pressing Ctrl-Alt-+ (using the Plus key on the numeric keypad), you command X to switch to the next video mode in sequence. X treats the video modes as a cycle: if X is operating in the last video mode, this key sequence causes X to return to the first video mode.
The similar key sequence Ctrl-Alt -- (using the minus key on the numeric keypad) causes X to switch to the previous video model. If you shift to a video mode that your monitor doesn't support?as demonstrated by an unsteady or garbled image?you can use this key sequence to return to a supported video mode, avoiding the inconvenience of terminating X and reconfiguring your system.
Even while X is running, you can access the Linux virtual consoles. For instance, you may find it useful to do so in order to recover from a X-related problem, so long as the problem hasn't frozen the keyboard. To switch from graphical mode to a virtual console running in text mode, type Ctrl-Alt-Fn, where F is a function key and n is the number of the desired virtual console. X uses virtual console #7, so only virtual consoles #1-6 are accessible while running X.
To switch from a virtual console back to X, type Ctrl-Alt-F7. Nothing is lost when you switch from X to a virtual console or back, so you can move freely between the graphical and text operating modes.
You can terminate X abruptly by typing Ctrl-Alt-Backspace. However, this method of terminating X is appropriate only when X is malfunctioning. Terminating X abruptly closes down running applications, which may result in loss of data.
In Windows, you don't need to restart in DOS mode simply to have access to the DOS command line. Similarly, in X you don't need to switch to a virtual console simply to have access to the command line. X enables you to open a terminal window. A terminal window resembles the MS-DOS Prompt window or command-line interface window; like a Linux virtual console, it lets you type commands and view command output. Various window managers support different methods of accessing a terminal window, as described in Chapter 5.
The terminal window is just one example of a frequently used program under X that you'll want to access. Most window managers install with a default set of common programs that can be accessed by right-clicking with the mouse on the desktop. For example, most window managers let you right-click on the desktop and select a terminal window program from the pop-up menu that appears. However, the pop-up menu displayed by a window manager may display program names rather than program functions. In this case, you may have some difficulty determining which entry on the pop-up menu corresponds to a terminal program. Many programs that provide terminal windows have names that include the sequences xt or xterm. Selecting such an entry will launch a terminal window. You'll learn more about window managers later in this chapter.
Mouse operations under X are similar to mouse operations under Windows, although you perform them differently. The most common mouse operations that behave differently are:
Copying and pasting text
To copy and paste text, you must first mark the text by moving the mouse to the beginning of the text; then click the left mouse button and drag the mouse across the text to be copied. X automatically copies the marked text into a buffer; you don't need to press Ctrl-C or perform any other operation. However, for compatibility with Windows, some window managers let you copy text by pressing Ctrl-C, or by right clicking and choosing from a pop-up menu. If you find that you need to change the size of the marked text section, you can click the right mouse button and move the mouse to adjust the marked text.
To paste the text, properly position the insertion point and click the middle mouse button. If your mouse has only two buttons, simultaneously click the left and right buttons to simulate clicking the middle mouse button. You may find that this operation requires a little practice before you get it right, but once you've mastered it, you'll find it works almost as well as having a three-button mouse. Some window managers will let you paste text by pressing Shift-Ctrl-V, or by right clicking and choosing from a pop-up menu.
Many X programs provide scrollbars that resemble those provided by Windows. However, the operation of scrollbars under X originally differed from that under Windows. Most X programs have been revised to display scrollbars that work like Windows scrollbars, although a few have not.
If you're having trouble using a scrollbar, it may have been programmed to use the original X method of interaction. This problem is more likely to affect old X programs than recent ones. To page forward using the original X method, click the left mouse button on the scrollbar. Clicking near the top of the scrollbar scrolls forward a short distance, as little as a single line. Clicking near the bottom of the scrollbar scrolls the window by a page. To page backward, click the right mouse button on the scrollbar. Again, clicking near the top of the scrollbar scrolls a short distance, as little as a single line. Clicking near the bottom of the scrollbar scrolls the window by a page.
Under X, your desktop can be scrollable; that is, larger than the size of your monitor. For example, even if your monitor has a maximum resolution of 800 x 600, you might have a desktop of 1600 x 1200 or even 3200 x 2400. Such a desktop is known as a virtual desktop.
Most desktop environments provide a tool called a pager, which lets you move around the virtual desktop. The pager provides a thumbnail view of your virtual desktop; by clicking within the thumbnail, you center your actual desktop on the clicked location. You'll learn more about pagers in the next two chapters.