@Chapter(The X Window System) The X Window System is a group of programs that let you divide your workstation's screen into one or more overlapping rectangular @b[windows]. Each window acts like a separate terminal, and you can do different things in each one. You can write a paper with @i(emacs) in one window, format a letter with @i(scribe) in another, compile a program in another, view your mail messages in still another, and so on. X makes the workstation a very powerful instrument. After you create the windows you want to use, you can move them around, shuffle them above or beneath one another, and make them any size you want. And you can remove individual windows from your screen at your pleasure. You manipulate windows using certain keyboard and mouse-action combinations. @section[Of Mice and Windows] The @i(mouse) is the small puck with some buttons on it that is attached to your workstation. The mouse controls the @i(mouse cursor) on your screen. When the mouse cursor is inside a window, it looks like a capital @b(I), and when it is over the @i(background screen) (the area outside every window), it looks like a hollow capital @b(X). When the mouse cursor is inside a window, that window is called the @i(active window). Whatever you type at the keyboard appears in the active window. When the mouse cursor is over the background screen (also called the @i(root window)), typing at the keyboard has no effect. Although X is the same on both the VAX and RT workstations, there are two differences between the two brands that affect you when you use X. The VAX mouse is different from the RT mouse. The VAX mouse has three buttons and the RT mouse has two. On the RT mouse, @i(pressing both buttons at the same time is equivalent to pressing the middle button on the VAX mouse). Another difference is in the location of the @i(META key). On the VAX, the META key is labeled "Compose Character"; it's located just to the left of the space bar. On the RT, the META key is labeled "Alt"; it's located on either side of the space bar. There are three actions you can perform with the mouse: @i(pointing), @i(clicking), and @i(dragging). @i(Pointing) is simply moving the mouse to put the mouse cursor in the right place. @i(Clicking) is quickly pressing and releasing any one of the mouse buttons (or two, for the "middle button" on the RT). @i(Dragging) is pressing a mouse button and holding it down while simultaneously moving the mouse. @section(Creating Windows with the xterm Terminal Emulator) The @i(xterm) program lets you create an additional window on your screen that acts like a separate terminal, hence its name. @subsection(Creating a Window) To create a new window, just type: @example(athena% @b(xterm &)) Unix types back: @begin(example) [1] 8389 athena% @end(example) Using the "@b(&)" causes the @i(xterm) program to run as a @i(background process). If you don't type the @b(&), you won't be able to work in your original window, since you will be running @i(xterm) in it. The [1] means that this is your first background process and the 8389 is its Process Identification number, or PID. After you type @b(xterm &), the mouse cursor will change into a bracket with a tiny "rubber band" window inside it. Also, in the upper left-hand corner of the screen, a small box will appear that says "xterm: 0x0". The 0x0 is the dimensions of the rubber band window in columns by lines. Now move the bracket (by moving the mouse) to the location on the screen where you want the upper left-hand corner of the window to be. With the three mouse buttons, there are three things you can do: @begin(itemize) @b(Click the left button) to create a window that is 80 columns wide and 24 lines high. @b(Click the right button) to create a window that is 80 columns wide and extends to the bottom of the display screen. @b(Drag on the middle button) to create a window of any size. As you move the mouse, the numbers in the box in the upper left-hand corner will change appropriately. Just release the middle button when the window is the size you want. @b[To perform this function on the RT, you must press both mouse buttons and drag.] @end(itemize) After you have created a window, you have to wait a few seconds for the prompt to appear before you can type in it. Once the prompt appears, you've got another window to work in! @subsection(Getting Rid of a Window) You can get rid of a window by typing @b(exit) in it. This @b[kills] the @i[xterm] process and makes the window vanish. You do not have to get rid of all of the windows that you create before you logout, though it is generally safer (except for @i(emacs) windows--exit these normally); the logout process will get rid of them for you. However, @i(you can logout only from your original login window). If you try to logout from any other window, you will get the message "Not login shell.". The @i[xterm] emulator has a million features that let you customize the size, position, and font type of your windows. For more information, see @p[Appendix C] of this document. @section(The Window Manager) When you login, the @i[login] process starts a @b[u]nix @b(w)indow @b(m)anager (@b[uwm]) for you. The window manager lets you shuffle, move, and resize the windows on your screen. Once the window manager has started, you don't need to start another. @subsection(Using the Window Manager) There are two ways to issue window manager commands: you can use the mouse, or you can choose commands from a pull-down menu. You issue commands from the mouse with various mouse button clicks and dragging combinations. @b[But the window manager does not recognize these combinations unless you press and hold the workstation's meta key at the same time.] Since there are only three buttons on the mouse (two on the RT mouse, but pressing them at the same time gives you a middle button), and two ways of using each (clicking and dragging), you can use the mouse to issue six different commands. @TabClear @begin [group] @center [@ux<@p(uwm) @b{Mouse Commands}>] @TabDivide (4) @\@b(Left Button)@\@b(Middle Button)@\@b(Right Button) @blankspace [0.7 lines] @b(Click)@\Push a window@\Restore iconified@\Bring a window @blankspace [0.1 lines] @\beneath others@\window@\to the front @blankspace [0.7 lines] @b(Drag)@\Iconify/deiconify@\Resize a window@\Move a window @blankspace [0.1 lines] @\a window @end(group) Here is a description of each of these commands: @begin(description) @b(Pushing a window beneath others)@\Think of your screen as displaying a @i(stack) (a messy pile) of windows. Clicking the left mouse button will push the active window to the bottom of the stack, away from you. @b(Bringing a window in front of others)@\Clicking the right mouse button will bring the active window to the top of the stack. @b(Moving a window)@\Hold the right mouse button down. As soon as you move the mouse, the active window will be outlined with a "rubber band." Then move the window to its new location by moving the mouse. @b(Resizing a window)@\To change the size of a window, move the mouse cursor to the corner of the window you want to resize. Hold the middle mouse button down; the mouse cursor will change into a cross with arrowheads on the ends. Move the mouse until the window is the desired size. Notice that in the corner opposite the mouse cursor, a small box displays the window's height and width in columns by lines (e.g., 80x24). As you change the size of the window, the numbers in the box change accordingly. Release the button when the window is the size you want. @label(resize) @\NOTE: After you resize a window, programs that use the window size to help them display their output will automatically know the correct size of the window. Perhaps one of these programs might not believe that the window is the size it is. If this happens, type @b(xresize) inside the window. (@i(xresize) is an @i(alias) that was defined in the system-wide @i(.cshrc) file.) If you have any questions about this, read the online manual page on @i(resize) by typing @b(man resize) or ask a consultant. @begin(multiple) @b(Iconifying a window)@\An @i(icon) is a small symbol that represents a window. It remembers the size and location of that window, so when you @i(restore) the iconified window, it will appear in its old location. You should iconify windows to clean up your screen if there are too many for you to easily see them all. To iconify a window, hold down the left mouse button and move the mouse; the mouse cursor will change into a cross with arrows on the ends. Now move the mouse cursor to where you want to put the icon, and release the button. The window will vanish, and its icon will appear at the mouse cursor's location. You can move icons just like window. Place the mouse cursor on the icon, press the right mouse button, and drag. NOTE: You can change an icon's title if you don't like it. To do so, move the mouse cursor over the icon, hit the DELETE key to remove the existing title, and then type in the new title. (Some icons don't have titles, but @i(xterm) icons do.) @end(multiple) @b(Restoring an iconified window)@\To restore an iconified window, move the mouse cursor over the icon and click the middle mouse button. The window will reappear in its old location. @end(description) @subsection[Window Manager Commands From a Menu] You can also issue window manager commands by making selections from a pull-down menu. To produce this menu, hold down the SHIFT key, the META key, and the middle mouse button. (The mouse cursor can be anywhere on the screen.) A menu called @b(WindowOps) will appear. Drag the mouse cursor (which now looks like an arrow) down the menu to the command you want, and then release the buttons. @i(Now), move the mouse cursor into the window you want the command to affect, and press the META key and the middle mouse button. The command will take effect. You may need to drag the mouse around, depending on which command you select.