While X itself is a single program, X under Linux supports several popular window managers, and two popular desktop environments.. Most window managers install with a default set of comm
Trang 16 Using the X Window System
Using the X Window System means interacting with Linux on several
different levels X itself simply provides the graphics for displaying
components of a graphical user interface: X draws the screen, draws objects
on the screen, and tracks user input actions such as keyboard input and
mouse operations To organize all of this into familiar objects like windows, menus, and scrollbars, X relies on a separate program called a window
manager A window manager alone won't necessarily assure tight integration between applications running under X; that higher degree of integration comes from something called a desktop environment While X itself is a single program, X under Linux supports several popular window managers, and two popular desktop environments
To use X effectively, you'll learn the basic keyboard and mouse operations for communicating with X If you're like most X users, you'll find it helpful
to use a window manager and a desktop with X You'll learn why window managers and desktops are useful and get help in choosing and setting up a window manager and a desktop
6.1 Keyboard Operations
Using the keyboard with X closely resembles using the keyboard with
Microsoft 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; however, under some circumstances, it can be the window beneath the mouse cursor
Trang 2This chapter refers to your pointing device as a mouse However, like
Microsoft Windows, X supports a variety of pointing devices
Microsoft Windows lets you choose to perform most operations by using the keyboard or mouse In contrast, X was designed for use with amouse If your mouse isn't functioning, you'll find it quite challenging or even impossible to use most X programs
Similarly, X provides a few important functions that you can access only via the keyboard:
Using virtual consoles
Switching video modes
In addition, you can use the keyboard to terminate X
6.1.1 Switching Video Modes
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 1024×768 pixels screen resolution
By pressing Shift-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
Trang 3The similar key sequence Shift-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 a
unsteady or garbled image - you can use this key sequence to return to a supported video mode, avoiding the inconvenience of terminating X
6.1.2 Using Virtual Consoles with X
Even while X is running, you can access the Linux virtual consoles To switch from graphical mode to a virtual console running in text mode, type
Ctrl-Alt-F n, where F n 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 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
6.1.3 Terminating X
As you learned in the previous chapter, you can terminate X by typing Alt-Backspace X immediately terminates each program running under X,
Ctrl-closes each open window, and returns your system to text mode
This key sequence terminates X abruptly; most window managers support gentler ways of terminating X You'll learn about these later in this chapter
While X is running, you cannot use the Ctrl-Alt-Del sequence to reboot
your system To reboot your system, you can terminate X and then use the
Trang 4Ctrl-Alt-Del sequence, or access a terminal window and enter the
6.1.5 Pop-Up Menus
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 left- or right-
clicking with the mouse on the desktop Most window managers, for
example, let you 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
Trang 5sequences xt or xterm Selecting such an entry will probably launch a
terminal window You'll learn more about window managers and how to use them later in this chapter
6.2 Mouse Operations
Mouse operations under X are similar to mouse operations under Microsoft Windows, although you perform them differently The most common mouse operations are:
Copying and pasting text
Using scrollbars
6.2.1 Copying and Pasting Text
To copy and paste text, you must first mark the text To do so, you move the mouse cursor to the beginning of the text, press the left mouse button, and drag the mouse across the text to be marked X automatically copies the
marked text into a buffer; you don't need to press Ctrl-C or perform any
other operation If you find that you need to change the size of the marked text section, you can press the right mouse button and move the mouse to adjust the marked text
Some window managers display a pop-up menu when you click the right button, even when the mouse cursor is above text When using such a
window manager, you cannot use the right mouse button to adjust the size of the marked text section
Trang 6To paste the text, properly position the insertion point and press the middle mouse button If your mouse has only two buttons, simultaneously press the left and right buttons to simulate pressing 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
6.2.2 Using Scrollbars
Many X programs provide scrollbars that resemble those provided by
Microsoft Windows programs However, the operation of scrollbars under X differs significantly from that under Microsoft Windows
To page forward using an X scrollbar, you 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, you 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
Some X programs redefine the operation of scrollbars to correspond to that provided by Microsoft Windows If a scrollbar doesn't respond as you
expect, try using the common Windows manipulations: left click below the scroll box to move forward, left click above the scroll box to move
backward, or left drag the scroll box to a desired position
Trang 76.2.3 Virtual Desktop
Under X, your desktop can be larger than the size of your monitor For
example, even if your monitor has a maximum resolution of 800×600, you might have a desktop of 1600×1200 or even 3200×2400 Such a desktop is
known as a virtual desktop Some desktop environments, including
GNOME, 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 Some window managers let you simply move the
mouse to the edge of the desktop to scroll the virtual desktop
6.3 Window Managers
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 Some Linux users who are accustomed to the look and feel of Microsoft Windows 9x use the FVWM window manager to establish a user interface that
resembles that of Windows 9x, both in appearance and operation Other Linux users prefer to avoid anything resembling a Microsoft product Table 6.1 describes the most popular Linux window managers For detailed
information about a variety of window managers, see the X11.Org web site
at http://www.x11.org/wm/
Trang 8Table 6.1: Popular Window Managers
Enlightenment A highly configurable window manager
FVWM One of the most venerable and popular Linux window
managers - small, efficient, and configurable Can mimic the Microsoft Windows 9x user interface Not fully compliant with GNOME desktop
ICEWM A fast, small window manager especially popular among
users of Debian GNU/Linux
Trang 9Table 6.1: Popular Window Managers
Window
Manager
Description
KWM A window manager that sports an accompanying desktop,
KDE The combination of KWM and KDE provides a robust and efficient user interface However, KWM includes some non-GPL code, inhibiting its adoption as the
de facto standard Linux window manager Not compliant with GNOME desktop
SCWM A window manager that has a powerful configuration
language, based on the Scheme dialect of LISP
WindowMaker Resembles the user interface of NEXTStep Compatible
Trang 10FVWM is perhaps the most popular Linux window manager Several other window managers have borrowed from its code base, so many of its
capabilities are found in other window managers Although FVWM lacks the visual flashiness of more recent window managers, it is robust and
highly configurable However, FVWM is not fully compliant with the
GNOME desktop; users who plan to use GNOME may prefer to choose a different window manager
6.4.1 KDE
Trang 11KDE (the K Desktop Environment) is a freely available desktop that
includes KWM, 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, including:
Games such as Kmines, Kpoker, and Ktetris
Graphical applications such as Kfract, a fractal generator, and Kview,
Although KDE is freely redistributable, KDE uses the QT widget set to create user interface controls This presents a problem, because QT is
distributed under a non-free license that many developers dislike Therefore, the most popular desktop environment in the U.S has been, and continues to
be, GNOME rather than KDE
6.4.2 GNOME
Trang 12GNOME is a freely available desktop that can be used with any of several window managers, including Enlightenment Unlike KDE, GNOME is open source software
One of GNOME's most interesting features is session awareness When you re-enter GNOME, 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
GNOME provides desktop tools similar to those of KDE, including:
Games such as FreeCell, Gnobots, Gnometris, and Gnome Mines
The GNU Image Manipulation Program (GIMP)
Network applications such as Mailman, which helps you track your mailing lists; Talk, which lets you exchanged typed messages with another user in real time; and Synchronize, which lets you
synchronize files on multiple systems
Multimedia applications such as Audio Mixer and CD Player
General applications such as gEdit, a text editor, Netscape Navigator,
a Linux version of the popular browser, and Gnumeric, a spreadsheet
Utilities for configuring GNOME and your Linux system
Trang 13GNOME developers, like KDE developers, release new applications
regularly Check the GNOME Web site at http://www.gnome.org/ for the latest information
6.5 Using GNOME
In this section, you'll learn how to configure and use the GNOME desktop and the Enlightenment window manager If you choose to use a different desktop or window manager, you should consult the documentation that accompanies each However, you should read this section anyway, because the procedures for configuring various desktops and window managers are more similar than different: the way you perform each step may vary but the function of each step will not
6.5.1 Launching GNOME and Enlightenment
Before starting GNOME, you must configure the X startup files Login as root, move to the /etc/X11 directory, and enter the following command:
cp Xsession Xsession.SAVE
This command makes a copy of your Xsession file so that you can restore it
to its current state if something goes wrong If you get an error informing
you that the Xsession file doesn't exist, simply ignore the error Next, using
ae or another text editor of your choice, edit your Xsession file to contain these lines at the beginning of the file:
#!/bin/bash
xterm &
Trang 14Table 6.2 gives possible values for window-manager, which lets you specify
which window manager you want to use You must have installed the proper package containing the window manager you select
Table 6.2: Window Manager Program Path Names
Window Manager Path Name
Enlightenment /usr/bin/X11/enlightenment
FVWM /usr/bin/X11/fvwm95
Trang 15Table 6.2: Window Manager Program Path Names
Window Manager Path Name
FVWM95 /usr/bin/X11/fvwm2
ICEWM /usr/bin/X11/icewm-gnome
Window Maker /usr/bin/X11/WindowMaker-gnome
To start GNOME, type the command:
startx
You should see the GNOME desktop, as shown in Figure 6.1 The contents
of your own desktop may be different, of course
Trang 16Figure 6.1: The GNOME desktop
6.5.2 Logging Out
To log out of GNOME, left click on the main menu, which resembles a foot,
as shown in Figure 6.2 From the pop-up menu that appears, select the Log Out menu item A Log Out dialog box, shown in Figure 6.3, appears and asks you to confirm your decision to log out Selecting Yes terminates your GNOME session
Trang 17Figure 6.2: Logging out of GNOME
Figure 6.3: The log out dialog box
6.5.3 Parts of the Display
Figure 6.4 shows the parts of the GNOME display, which are described in the following sections
Trang 18Figure 6.4: Parts of the GNOME desktop
6.5.3.1 Home directory icon
The home directory icon normally appears in the upper left corner of the display and resembles a file folder in appearance The icon provides a
convenient way to access the file manager: double clicking the icon with the left mouse button launches the file manager, which displays the contents of the user's home directory
6.5.3.2 Desktop
The desktop is the empty area of the display, where no windows or icons appear Clicking the desktop with the middle mouse button causes a pop-up menu to appear; the menu lets you conveniently launch popular applets and