start page | rating of books | rating of authors | reviews | copyrights

Book HomeLearning UnixSearch this book

2.5. Working with Windows

A window manager program helps you control windows. Various window managers do the same kinds of things, with some variation. Let's start by looking at Figure 2-4, which shows a typical window under KDE and kwm.

The edges of the window can be used to resize the window. The top of every window has a titlebar that includes the window title as well as three buttons.

2.5.1. Using the Titlebar

The titlebar is the top of a window; it has the window's title, and, usually, some buttons or other features. See Figure 2-4.

Figure 2-4

Figure 2-4. A window under KDE and kwm

The three buttons at the top right corner have boxes inside them.

NOTE: It's not always a good idea to click the "X" box on a window frame--especially on a terminal window with a program running inside. Although it may seem to work (because the window closes), the programs running inside the window may not have time to finish their work and exit gracefully.

It's safer to use the program's own "exit" command. For instance, if you're running the Pico editor in a terminal window, use its CTRL-X command. If you have a shell prompt, type exit or press CTRL-D; if the program has a menu or button with which to quit, use it. If there's no other choice, though, you're probably safe to click the "X" box on the frame.

The left button opens the window menu; this is explained in Section 2.5.5 later in this chapter.

2.5.2. Moving Windows and Icons

To move a window, start by pointing to the titlebar. Hold down the first mouse button and drag to the new location--then let go of the button.

2.5.3. Resizing Windows

If you have the pointer inside a window and then move the pointer to an edge, the pointer will probably change to another shape--an arrow, for example. If you point to a corner, you may be able to resize both sides that meet at the corner. To resize when you have the arrow pointer, press and hold (typically) the first button, then drag the window border until the window size is what you want and release the button. If you don't get quite the size you want, just do it again.

NOTE: If you're using a terminal window (such as xterm), and a program is already running in that window (not just a shell prompt), note that resizing the window may confuse the programs currently running in it! It's best to set the terminal window size before you run a program.

Also, remember that standard terminals are 80 characters wide. If you're editing text in a window with a width that isn't 80 characters, it can cause trouble later when the file is viewed on a standard terminal.

2.5.4. Stacking Windows

You can have many windows open at once. To get some or all out of the way, minimize them. Sometimes, though, you'll want several overlapping windows on your screen:

To bring a window to the top, you can generally either click on its title bar with the first mouse button or use the window manager's "raise window" command. That "raise window" command is usually either on the window menu (see the following section), on a window manager menu (choose "raise window," then click on the window you want to raise), or it might be found by clicking on the window frame with the third mouse button. In the same way, your window manager probably has a "lower window" command that moves a window behind the windows it overlaps.

2.5.5. The Window Menu

Many window managers let you control each window by its own window menu. There are lots of ways to get a window menu. Here are two: click on the menu button at the top left corner of a frame (as in Figure 2-4, for KDE and the kwm window manager), or click on an icon (for the mwm window manager). Figure 2-5 shows a window menu from the Sawfish window manager. When the menu pops up, you can point to an item and click it.

Let's look at some of the Sawfish window menu operations:

Figure 2-5

Figure 2-5. A Sawfish window menu

On the mwm menu (not shown here), a keyboard shortcut follows each command. Other window managers may have keyboard shortcuts but not list them on the menu (they could be listed on a configuration menu somewhere else). With a shortcut, you don't have to use the mouse to choose commands; you can handle window operations without taking your hands off the keyboard. For example, next to the Minimize entry is the shortcut hint "Alt+F9", which means that you can minimize this window without a mouse by holding down the ALT (or META) key and pressing the F9 key. Holding the SHIFT key and pressing the ESC key brings up an mwm window menu (and takes it away). If your keyboard doesn't have all of those keys, the menu can probably be customized to use others. Other window managers may have different keyboard shortcuts--or none at all.

2.5.5.1. Exercise

If you don't have two terminal windows open from the previous exercise, please start by opening them.

Copy and paste part of a command line.

Type who am i;date and press RETURN in one terminal window. Highlight the who am i, set focus to the other terminal window, paste the command there, and run it.

Move a window.

Grab and drag the window by its titlebar.

Iconify a window from the titlebar.

Use the Mimimize button.

Restore (de-iconify) the window.

Find the window's Restore command.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.