Jan. 18, 2011, 8:37 a.m.
posted by juff
We now delve into the nitty-gritty details of how to get stuff done using whatever window manager you happen to have on your computer. Because Motif is the most common window manager, we spend a fair amount of time on it in this book. If something we say is specific to Motif, we tell you.
If you’re lucky enough to have some version of the Common Desktop Environment (CDE), KDE, or GNOME, you can skip to the appropriate section later in this chapter. Because the Common Desktop Environment is built on Motif and KDE looks a lot like CDE, we recommend that you read this section anyway to find out the basics about windows, icons, mice, and the various and sundry widgets you encounter.
When you run a new X program, generally speaking, it opens a new window. In some cases, you want to tell a program that’s already running to open another window (another file for a word processor, for example), although the way you do that is specific to each program. You have to read the manual (gasp!) for the program.
You usually have at least one terminal window running. A terminal window isn’t as sinister as it sounds: It’s a window that acts like a terminal. The usual program is called xterm; it acts much like an antique DEC VT100 terminal. Most systems also have a modified terminal program that acts like the computer maker’s favorite terminal. Hewlett-Packard systems have hpterm, for example, which acts like an HP terminal, and some PC UNIX systems have xpcterm, which acts like a PC console. For most purposes, all these terminal programs act the same. They start up running a UNIX shell, and you type commands just as we describe in this book.
You can use one of two ways to start a new program that opens a new window: the GUI-oriented, user-friendly way and the easy way.
Follow these steps for the GUI-oriented, user-friendly way:
Move the cursor so that it’s not in any of your current windows.
Click the Menu mouse button.
Drag the mouse up and down the menu that pops up until you find the program you want.
Let go of the button.
Sometimes you have nested menus: When you pick an item from the first menu, a second menu pops up, and you must pick an item there, too.
The easy way to start a program has only one step:
Go to a terminal window and type the name of the program you want to run.
This approach is the same one you use to run any other program or to give a command. To display another terminal window, type xterm or the name of the terminal program you use.
Tip Then you have the issue of where on-screen the new window appears. Some programs and window managers have strong opinions of their own, and the new window appears wherever the program or window manager thinks that it should. With other, less opinionated programs, you make the call: A ghostly window that appears floats near the middle of the screen. You move the ghost around with the mouse and click when the window is where you want it. At that point, the ghost materializes into the regular window. This latter scheme is usually more convenient because the locations the opinionated programs choose for window placement are rarely where you want them. Beware of one thing, though, while the ghost is on-screen: All other windows are frozen. If you leave the ghost on-screen for a long time (while you’re at lunch or overnight), all the others can become rather constipated waiting for the screen to unfreeze so that they can update their windows. If you’re using Motif, your local guru can switch your system between opinionated mode and floating-ghost mode.
Some systems have desktop manager programs (unrelated to window manager programs) that attempt to make handling programs and files easier. Desktop managers have sets of icons you click to start common programs. They enable you to click filenames to edit the file, for example — sort of like the Macintosh Desktop. Opinions vary on how useful these desktop managers are. We haven’t been crazy about them, although trying them for a few minutes is worth your time because some people find them much easier to use than menus and shell commands.
GUIs are crazy about pictures (they’re graphical, after all), especially cute, little ones. The cutest, littlest ones you run into are called icons. An icon is a little picture in a little box on-screen that represents a window. When you tell X Windows to “iconify” a window, the window disappears and an icon remains. When you double-click (or single-click if you’re not using Motif) the icon, the window comes back just as it was before. Being able to reduce windows to icons enables you to shove programs out of the way and not lose what you are doing — one of the best things about window systems. Figure shows a pair of icons, one for an e-mail program and one for a terminal program. If new mail arrives, the little flag on the mail icon flips up, which is almost useful enough to make up for its X-treme cuteness.
Motif (or, more particularly, the Motif window manager) draws a border around every window on your screen, as shown in Figure. The border gives you considerable control over the window, enabling you to move it, hide it, change its size, and perform other tasks.
Warning The borders of some windows are missing some or all of the buttons we discuss in this section. That’s because not all windows allow all functions. If the button’s not there, you can’t do what it would have done anyway.
You frequently will find that you don’t like the way the windows on your screen are arranged. You can do lots of things to alleviate this problem and simultaneously waste lots of time. We have found that, by giving your dedicated attention to window management, you can spend the entire day at the computer apparently working but not accomplishing anything. Because a little rearrangement is inevitable, the following sections are thumbnail sketches of what you can do and how to do it with Motif:
Change the layering. Change which windows are in front of other windows, much like shuffling the papers in the pile on your desk. Unless you’re a masochist, you want the active window (the window you’re using) to be the one in front.
Move windows around the screen. This process is even more similar to shuffling the papers on your desk.
Turn windows into icons and vice versa.
Change the size of windows. Create larger areas for long files you’re editing, for example.
Switching and layering your windows
Suppose that you have two or three windows on-screen. How do you tell UNIX which window you want to use? The answer is (wait, no — how did you know that this answer was coming?) it depends. In line with the standard X rule of never making up its mind about anything, you can switch windows in two different ways:
Click-to-type, or explicit focus: Move the mouse cursor to the window you want to use, and click the mouse in it somewhere. The window moves to the front (any overlapping windows drop behind it so that you can see the entire window).
Move-to-type, or pointer focus: Move the mouse cursor into the window you want to use. Even though the window may be partially obscured by other windows, it becomes active. You can tell when a window is active because the border around it changes color. Click the window’s title bar if you want to move it to the front. Motif also enables you to move a window up front like this: Move the cursor into the window, hold down the Alt or Meta key, and press F1.
Warning If you have to “click to type” and hate it — or don’t and really want to — a guru skilled in the ways of X (naturally called an X-pert) can change some parameters and turn “click to type” on or off. We recommend that you live with whatever you have. So many changeable parameters are available that, after you begin fiddling with them, it can become X-asperating to figure out X-actly how your X-pert left them, and you will utter an X-cess of X-pletives.
Tip You can tell which is the active window because the Motif window manager changes the color of its border to a distinctive darker color. The Motif standard window-switching rule is click-to-type.
“Where, oh, where has my window gone?”
In Motif, you put the cursor in the title bar, press the first mouse button, and drag the window to where you want it (that is, you move the window as you hold down the mouse button). This action also brings the window to the front because you use the same button to do that.
You can move windows so that they are partially off the edge of the screen, sort of like pushing papers to the side of your desk so that they hang over the edge (except that windows are less likely to fall on the floor). This capability is sometimes useful if the interesting stuff in the window is all at the top or all on one side.
Stashing your windows
The title bar of the window has little buttons you can click. Near the right end of the title bar is a little box that contains a small dot; when you click it, you iconify the window; that is, the window turns into an icon.
To get the window back, double-click the icon with the first mouse button.
Tip Icons normally appear in the lower-left corner of the screen, although you can move them around by dragging the icon around with the mouse. After you move an icon, if you restore the window and then re-iconify it, the icon reappears where you left it. You can lay out the icons to your taste by iconifying every window on-screen, moving the icons to tasteful positions, and then restoring the ones you want to use.
Curiouser and curiouser: Changing window sizes
The last little bit of window magic involves changing window sizes. Motif has gone to a great deal of trouble to let you change the size of your windows, which tells us that they gave up trying to make them the right size in the first place. Oh, well. Little “grab bars” are in each corner of most windows. (The few windows you can’t resize don’t have grab bars.) You move the cursor to one of the grab bars, click the first mouse button, drag the corner to where you want it (make the window larger or smaller), and release the button.
Then do it again two or three times because you never get it right on the first try. Motif also has grab bars (thin, gray borders) on the top, bottom, and sides of every window, which enable you to change the height of a window without changing the width or vice versa.
Warning Some programs have strong feelings about how big their windows should be. In some cases, they don’t let you shrink the window to less than a minimum size. In other cases, you can’t change the size. For these programs, attempts to resize just don’t work. You can click and drag the borders all you want, but nothing moves.
Motif has a shortcut to enable you to expand a window to fill the entire screen. Click the little box-in-a-box at the right end of the title bar. If you do the same thing again, the window shrinks back to normal size.
In practice, we rarely blow up windows to full-screen size because few UNIX programs take advantage of the entire screen. The full-screen option was much more important when screens were smaller.
Your screen often becomes cluttered with windows you no longer need. You already know how to turn them into icons to get most of the screen space back, but sometimes you just want to make the program go away.
Remember If 57 different programs are running, even if most of them are snoozing behind their icons, it can put enough of a load on your computer to slow down the ones you want to use.
Most programs have a natural way to exit. In terminal windows, you log out from the shell by typing exit or logout in the terminal window. Real windows-oriented programs usually have menus of their own with a Quit or Exit option that cleans up and makes the program stop. Because some programs just won’t die, however, you have to take drastic measures.
In Motif, click the little bar in the box at the left end of the title bar; a menu of window operations pops up, as shown in Figure. The Restore, Move, Size, Minimize, and Maximize choices are equivalent to the border-clicking techniques we discussed in the preceding section. (Minimize is Motif-ese for iconify.) The two remaining options can be useful, though. The Lower option pushes the window behind all the rest so that it doesn’t obscure any other windows. That option is useful when you want to work on something else for a while. Close closes the window and usually also ends the program that started it. This option can be handy for programs that get stuck or don’t have any normal way to exit.
Tip Motif offers a set of keyboard equivalents for mouse-haters. To display the window menu, press Shift+Esc or Alt+spacebar. Then either press the cursor keys and Enter to choose one of the entries, or press the underlined letter in the entry you want. To move or resize windows, you press the cursor keys to move or resize the window and then press Enter when you finish.
You can also press the Alt+key equivalents on the menu, such as Alt+F9 for to minimize a window. If your keyboard has two Alt keys (as most PC keyboards do), you may find that the two Alt keys work differently. Individual programs recognize the left Alt key on our system, and the Motif window manager recognizes the right Alt key.
Warning Motif uses confusing and inconsistent names in the window-operations menu. Close destroys the window and the program, and Minimize turns the window into an icon.
The last little detail is how to tell X Windows that you’re finished with it. The way you do that (we’re getting tired of saying this) varies from one system to another. You have to stop the start-up program, which is usually a terminal window named login or the window manager itself. If you see a window named login, go to the login window and type exit or logout to exit that shell.
If your start-up program is the window manager, you must persuade the window manager to exit. You can’t kill it the way you kill other programs, because the window manager doesn’t have a particular window. In Motif, you move the cursor outside any window, press the first mouse button, and select the Quit item from the menu that pops up. Motif pops up another box, incredulous that you claim that you want to leave a program as wonderful as itself, so you have to click OK to assure it that you are indeed such an ingrate.