2.3 Running ProgramsOne of the most important X features is that windows can come either from programs running on another computer or from an operating system other than UNIX. So, if your favorite MS-DOS program doesn't run under UNIX but has an X interface, you can run the program under MS-DOS and display its windows with X on your UNIX computer. Researchers can run graphical data analysis programs on supercomputers in other parts of the country and see the results in their offices. There's much more than we could cover here. The O'Reilly & Associates book X Window System User's Guide, Volume Three, OSF/Motif Edition has all the details. 2.3.1 Setting FocusOf all the windows on your screen, only one window receives the keystrokes you type. This window is usually highlighted in some way. By default in the mwm window manager, for instance, the frame of the window that receives your input is a darker shade of grey. In X jargon, choosing the window you type to is called "setting the input focus ." Most window managers can be configured to set the focus in one of the following two ways:
When you use mwm , any new windows will get the input focus automatically as they pop up. 2.3.2 The xterm WindowOne of the most important windows is an xterm window. xterm makes a terminal emulator window with a UNIX login session inside, just like a miniature terminal. You can have several xterm windows at once, each doing something different. To enter a UNIX command or answer a prompt in a window, set the focus there and type. Programs in other windows will keep running; if they need input from you, they'll wait just as they would on a separate terminal.
Figure 2.2
D
and
Figure 2.4
show a single
xterm
window with a shell prompt ( You can also start separate X-based window programs (typically called clients ) by entering commands in an xterm window. Although you can start new clients ( xterm , xcalc , and so on) from any open xterm window on your computer, we recommend starting all of them from the first window that you opened. If you do that, and if your shell has job control (see Chapter 6, Multitasking ), it's easy to find and control all the clients. Here's an example. To start the calculator called xcalc , enter:
%
The shell will print a PID number like 12345.
(
Chapter 6
has more information on this subject.)
If you forget to add the ampersand ( The new window may be placed and get the focus automatically. Or, the window (or an outline of it) may "float" above the display, following the pointer - until you point somewhere and click the mouse button to place the window. You can also start a new xterm from an existing xterm . Just enter xterm & (don't forget the ampersand) at the shell prompt. 2.3.3 The Root MenuIf you move the pointer onto the root window (the "desktop" behind the windows) and press the correct mouse button (usually the first or third button, depending on your setup), you should see the root menu . You may need to hold down the button to keep the menu visible. The root menu has commands for controlling windows. The menu's commands may differ depending on the system. Your system administrator (or you, if you study your window manager) can add commands to the root menu. These can be window manager operations or commands to open other windows. For example, a "New Window" menu item can open a new xterm window for you. A "Calculator" item could start xcalc . 2.3.3.1 Exercise
2.3.3.2 Problem checklist
|
|