One 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.
Of 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:
Point to the window and click a mouse button (usually the first button). You may need to click on the titlebar at the top of the window.
Simply move the pointer inside the window.
When you use mwm, any new windows will get the input focus automatically as they pop up.
One 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.
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.
xcalc & 12345 %
The shell will print a PID number like 12345.
(Chapter 6 has more information on this subject.)
If you forget to add the ampersand (
&) at the end of the line,
kill (terminate) xcalc with your interrupt character (like
to get another shell prompt - then enter the command correctly.
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.
If 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.
Change to your home directory.
Practice setting focus on both new windows and entering UNIX commands in each.
Click on window and/or move
pointer there. Enter
Start the clock from one window.
Start the calculator from one window and try it.
Change working directory (see Chapter 3, Your UNIX Account ) in only one window.
Check working directory (see Chapter 3) in both windows.
Set focus on the xcalc, and type your interrupt character (such as [CTRL-C]
You may need to run the xhost command. See your system administrator or an experienced X user.
Your DISPLAY environment variable may not be set correctly or you may need to use the -display option. Ask for help or refer to the X Window System User's Guide, Volume 3.