
The structure of this document and its exercises is intended to help you to become acquainted with X. When beginning to read this document, keep in mind the following advice: you may find it helpful to read through a section, and then go back and do the exercises.
Section 1 presents an overview of X and introduces some important terms.
Section 2 covers the basics required to start and end an X session and to use the mouse.
Section 3 explains the Tab Window Manager's (TWM) functions and its menus.
Section 4 gives a brief description of the terminal window, and it lists the various options available through it. The remainder of this document is not essential to working with X.
Section 5 discusses the advanced topic of remote processes. You may find it useful if you wish to display work from more than one computer at a time.
Appendix A lists other sources for more information on X and related software.
Although this document covers X in general, naturally many of the examples will be specific to the implementations of X on networks maintained by Information Systems (such as Owlnet and the Rice Advanced Visualization Lab).
Finally, this document includes several references to the UNIX (UNIX is a registered trademark of AT&T Bell Laboratories) operating system. For more information about UNIX, see the Information Systems document UNIX 1, Introduction to the UNIX Operating System.
Good luck!
The X Window System
This section describes X's features and limitations. Some of the details may seem tedious at first, but understanding the concepts presented here will facilitate learning more about X.
The activity within one window executes independently of the activity in the other windows. For example, you can compile a FORTRAN program in one window, read electronic mail in another, run a clock in a third, and run a text editing program in a fourth window. This feature makes X very powerful because you can access many different applications---even different computers---from a single terminal; you simply open new windows as needed.
First, and foremost, however, X is a windowing system, not a complete operating system. UNIX is an operating system. See the Information Systems document Introduction to the UNIX Operating System for more information on UNIX. X mediates the communication between individuals and a computer network. X creates windows that represent applications, but does not execute the applications itself. In the current Information Systems (IS hereafter) configuration, applications most often run on computers separate from an individual's computer terminal.
You can tailor X to suit your needs. For example, you can tell X to run certain applications automatically each time you start an X session. That saves you the trouble of starting them manually every time you log in.
As an example, the Owlnet Sun 3/50 workstations act purely as X display servers. In these cases, any clients you start are not executing on your computer. X directs your input to a host and directs output to your display server. On Owlnet, your clients actually execute on one of the Sun SPARCstations named arcadien, barred, boreal, elf, hawk, spotted, and so on.
If the term "client" causes confusion, you can substitute "application" if that makes X concepts easier to understand. Similarly, "terminal" can be substituted for "display server."
For example, one display might use two screens to display a very wide Mercator map of the world. This could be accomplished using one monitor or two. Some machines have a single physical video monitor (and a single display) but that display has two screens: a black-and-white screen and a separate color screen.
One special window is the root window, which forms the background of the display. Inside the root window you can perform window management functions rather than ordinary input and output with a window.
Windows can also be represented by icons. Icons are small rectangular symbols used to keep many clients from cluttering the screen. Generally, you cannot send input to a client's icon. First you must de-iconify the icon to convert the icon into a window; then you may send input to that client. After completing input, you can iconify the window to convert it into an icon. A client will continue to execute when in its iconic form. For example, you can open a window, enter the input to run a program, and iconify the window. At some later time you can de-iconify the icon to view the program's output.
The cursor lets you know where the pointing device is pointing on the screen. The cursor may be an arrow, an `X,' or some other symbol. Depending on the pointing device's target, the mouse buttons may invoke different operations. The cursor symbol usually changes to indicate these changing targets. For example, in the body of most windows the cursor is an I-beam, on the title bar the cursor is an arrow, and on the root window the default cursor is an `X.'
The window manager is a special client of the X server. It is the only client with the ability to move, resize, map, unmap, iconify, and deiconify windows. The window manager normally has no windows itself, with the exception of the menu windows the user can summon. It is possible to run an X session without using a window manager, but parts of windows hidden under other windows would be inaccessible.
Several different window managers exist, and each user can choose his or her own window manager. However, you can only use one window manager at a time. For example, suppose there are two window managers available: the Tab and Motif Window Managers. Now when you log on, you may use either the Tab or the Motif Window Manager, but not both.
A later section discusses the Tab Window Manager in detail.
Part of customizing X is changing your default window manager behavior to produce a display that suits your own needs. (See the separate Information Systems Document Customizing X for information on altering the default X environment and customizing TWM.) Other window managers include the "Motif Window Manager" (mwm), the "OPEN LOOK Window Manager" (olwm), and the Silicon Graphics Window Manager (4Dwm) used on the SGIs in RAVL and Fondren Library.
A blinking vertical line represents the text cursor. The cursor should stand to the right of the Login: prompt. If not, press RETURN until it does. (The "Login failed, please try again." message may appear but you can ignore it.) Type your userid, then press RETURN. The cursor moves to the Password: prompt. Type your password; it will not be displayed as you type to prevent other people from learning it. Then press RETURN.
If you have entered a valid userid and corresponding password, the display changes and brings up a system announcements dialog box. This box displays recent important systems notices, and it has a HELP button and a GO AWAY button.
For help on your system (be it Owlnet, the Rice UNIX Facility, or some other), move the cursor onto the HELP button, and click a mouse button. Otherwise, click on the GO AWAY button to make the system announcements box disappear and begin the X session.
If you mistyped your userid or password, the message "Login failed, please try again." appears. You can enter your userid and password again.
Sometimes you will find a Sun with a completely blank screen, displaying nothing. Three explanations for this condition exist.
If the computer displays the first message, type CTRL-C, (see the section, Special Keys, for information on the CTRL key) and the second message appears.
At the wahoo login: message, enter your userid, then password. The display changes to a text-only welcome message, and shortly the prompt wahoo% appears at the bottom of the display.
Enter startx to begin the X session. On these terminals, after you end the X session you will have the option to remain logged on by pressing CTRL-C within three seconds after exiting. If you press CTRL-C, the X windows and background vanish, returning you to a text-only display. At the prompt wahoo% (recall that "wahoo" is just a single computer name; your computer name may be different), enter exit to log out.
For example, to type `CTRL-C' you hold down the CTRL key and press C. While this action is analogous to typing `SHIFT-C' to generate a capital C, the computer interprets `CTRL-C' as an entirely different character than `C.'
Most keyboards have SHIFT and CTRL keys, but the META key may not be obvious. The table below lists the META key depending on your computer terminal.
TABLE 1: META Key Assignments
Terminal Type Keyboard Key(s) Sun 3/50, Sun 3/110 "Left" or "Right" Sun SPARCstation Diamond () oρ EΣ× Silicon Graphics Indigos and Indys Diamond () oρ EΣ× IBM XStation "Alt"
You will observe that the shape of the cursor changes depending upon where the cursor lies. These shapes indicate that different functions have become available. The section, The Tab Window Manager, explains what the functions do and how to execute them. Some cursor examples follow; these are the defaults and the user may change them.
Read the section, Window Operations without Menus, for a list of the mouse-selectable operations available.
To select an item, move the cursor (you must hold down the mouse button) onto the menu and highlight the desired menu item. Releasing the mouse button with the cursor in place selects the item.
To drop the menu without selecting any item, move the cursor off the menu so that no menu items are highlighted. Release the mouse button, and the menu vanishes without selecting an item.
Press and hold RIGHT. A menu titled "X Applications" appears, and the cursor becomes a horizontal arrow. Move the arrow onto the editor you want to use and it becomes highlighted.
Release the button to finish the menu selection. After a moment, a window frame appears. Position the window where you want it, then press LEFT or MIDDLE.
Terminate one of the editor windows (your choice) by moving the cursor over its "Quit" button (or box). Click to terminate the window.
Selection of one character, word, or one line (clicking):
Exercise 6. Selecting by Word. Place the I-beam cursor over the word "portable," then click LEFT twice. Notice that the word "portable" becomes highlighted; you have selected a word.
Now put the cursor over "The" in the sentence "The X Window System..." Click LEFT twice, but continue to hold LEFT down after the second click. Move the cursor along the rest of the sentence, and observe that you select words as the cursor moves.
Finally, put the cursor over "developed" and click LEFT twice. Move the cursor to the word "machines" and click RIGHT to make your selection. Move the cursor to other parts of the xterm, click RIGHT and watch how the selection changes by word.
Exercise 7. Selecting by Line. Put the cursor on the line "X Window System is a..." and click LEFT three times in rapid succession. You select the entire line of text.
Move to the line "It should be relatively..." and again click LEFT three times, but hold LEFT down after the third click. Now slide the mouse up and down, selecting text by line. Release LEFT after making a selection. Go to the line "X Consortium..." and click LEFT three times. Now move to the line "X Window System..." and click RIGHT. Witness the selected lines. Try clicking RIGHT elsewhere in the window, and see how the selection of lines changes.
Exercise 8. Practice all three methods of text selection (by character, by word, and by line). Also practice using just LEFT to select the range, and using LEFT and RIGHT to select the range.
For example, if you select the sentence "Six and nine are fifteen," then "Six and nine are fifteen" enters temporary storage. If you then select "How's the weather?" this new selection replaces "Six and nine are fifteen" in temporary storage. Now if you paste text, you will paste "How's the weather?"
Because of this feature, you need to be careful not to mistakenly select text. If you select the sentence "The dog ran quickly," but then accidentally press the mouse buttons and highlight other text, that other text replaces "The dog ran quickly" in temporary storage, and you must re-select "The dog ran quickly."
Once you have copied a selection, you can paste it elsewhere (including a different window). To paste the selection, move the cursor to the desired insertion point, then press MIDDLE.
Exercise 9. Copy and Paste. You should have a text editing window open already. If not, open one from the X Applications Menu. Now, inside the xterm, select the text between the sections headed "SYNOPSIS" and "DESCRIPTION." Go to the bottom text-entry area in the window and press MIDDLE. The selected text appears in the window. You have copied and pasted the text from the xterm to the text editing window.
Copy and Paste Again. Within the window, select the word "relatively." Place the cursor elsewhere in the text-entry area, and click LEFT once to mark the new insertion point. Now click MIDDLE and notice where "relatively" is pasted into the text.
Sometimes you will want to move or remove the selected text rather than copy it. To cut text, select it and then type CTRL-W. The highlighted text vanishes, but it has also been copied to temporary storage so that you can paste it if you like. Note, however, that not all X clients permit cutting.
Exercise 10. Cut and Paste. Inside the editor window, select the line "UNIX(tm) System V..." Then type CTRL-W to cut the line. Move the cursor to where you want to paste the line, click LEFT, and then click MIDDLE to paste it.
Now move to the xterm and select the line "Ultrix 3.1 (Digital)." Type CTRL-W, but notice that the client does not let you cut text. Go back to the window and click MIDDLE; the line "Ultrix 3.1(Digital)" appears. You copied the line by selecting it but were unable to cut it. Remember that selecting text automatically copies it into temporary storage, but not all clients support cutting.
Exercise 11. Put the cursor over a window and press RIGHT. You may see X highlight a text selection, but ignore it.
Press META-RIGHT (while holding down the META key, press and hold RIGHT; you can then release the META key.) The TWM Window Manager Menu appears. You have just used a special key (META) with the mouse. Deactivate the menu by not highlighting any of its items, then releasing the mouse button.
Exercise 12. Prepare the Scrollbar. Move to an xterm and enter the following (using a capital `X'):
Exercise 13. Use the Scrollbar. The scrollbar uses a gray rectangle (the "thumb") to indicate what part of the information is being displayed. Put the cursor over the scrollbar, and the cursor becomes a two-pointed arrow. Click RIGHT a few times and notice how the text and thumb scroll backward. Then click LEFT. Now place the two-pointed arrow anywhere on the scrollbar and click MIDDLE. Try pressing and holding MIDDLE, then dragging while holding down MIDDLE. The scroll area slides up and down as you drag the mouse.
Important Note: If you used the startx command to start the X session (if you are working on a Sun workstation, for example), after you end the X session you will have the option to remain logged on by pressing CTRL-C within three seconds after exiting. Doing so will cause the X windows and background vanish, returning you to a text-only display. At the prompt wahoo% (recall that "wahoo" is just a single computer name; your computer name may be different), enter exit to log out.
If these methods do not work, consult the section Introduction to the UNIX Operating System in the Owlnet Notes, see the Information Systems Document Introduction to the UNIX Operating System, or speak to a consultant in the Consulting Center, 103 Mudd Lab, or call 527-4983.
Go to an xterm and enter
man command
where command is the command you want to investigate (such as xcalc, xclock, etc.). UNIX will search for the appropriate manual pages and let you view them.
Alternatively, you can view formatted (text with italics, boldface, etc.) manual pages by selecting Manual pages from the X Applications Menu. After a moment, a small dialog box appears. Click on either of the oval command buttons labelled Manual Page or Help. Either button brings up a corresponding window. From the Manual Page window, you can click on the Options display button for a menu. Select Display Directory to see a list of the available commands. You can then use the scrollbar to view the commands, and click LEFT on a command you want to investigate.
Exit the formatted manual pages with the Quit button.
Call up the formatted manual pages from an xterm with:
xman &
This command is identical to selecting Manual pages from the X Applications Menu.
Exercise 14. Try calling up the regular manual pages. Go to an xterm and enter:
Exercise 15. Call up the formatted manual pages from the X Applications Menu. Click on Help if you like. When ready to investigate some commands, click on Manual Page. Browse through the Directory and read about some commands (xterm or maze, for example). Use the Quit button when you have finished.
The Tab Window Manager (TWM)
As the section,
Window Managers, explains, X may use a window manager, which controls functions like moving, resizing, and iconifying windows. Several different window managers exist, but recall that you can use only one window manager at a time. IS-administered machines use the Tab Window Manager, or TWM, almost exclusively, and this section describes TWM in its normal configuration. Hence, this section assumes you are running X and TWM, and it assumes that you have not customized X or TWM. For information on customizing X and TWM, see the separate IS document Customizing the X Window System.
Some applications---such as GNU Emacs, Matlab, or Mosaic---have separate documentation available. Check the Owlnet Notes or the Consulting Center for Information Systems documents. The applications are described very briefly below.
Text Editors
TABLE 2: Executing TWM Functions with the Mouse/Special Keys (Continued)
--------------------------------------------------------------------------
Cursor Special Mouse Button
Location Keys LEFT MIDDLE RIGHT
Root Window Circle up(a) TWM Menu X Appl.
Menu
Title Bar Bring to front Move Send to back
Left Title Bar Iconify Iconify Iconify
Button
Right Title Bar Resize Resize Resize
Button
Title Bar or Win META Bring to front Send to back TWM Menu
dow Body
Icon De-iconify Move ---
Title Bar, Icon, or META- --- --- Kill window
Window Body SHIFT(b)
--------------------------------------------------------------------------
To overcome these potential problems, X offers xterm, which is available from the X Applications Menu. Xterm simulates two widely available industry-standard terminals: the VT102 and Tektronix 4010 terminals. Normally the VT102 displays text, and the Tektronix 4010 displays graphics. Only one of these modes is active at a time, though both may be mapped on the screen simultaneously.
Backspacing does not erase characters on the screen (although the computer processes the backspace properly), and characters typed over one another simply print on top of each other, creating a messy jumble. Changing font size does not resize the window (as occurs with the VT window), but subsequent characters appear in the new size. Normal screen-clearing commands do not work, and you cannot select text with the mouse.
TABLE 3: Calling Up Xterm Window Menus
--------------------------------------------------
xterm Menu Mouse Cursor Location
--------------------------------------------------
Main Options CTRL-LEFT Over a VT or Tek window
VT Options CTRL-MIDDLE Over a VT window
VT Fonts CTRL-RIGHT Over a VT window
Tek Options CTRL-MIDDLE Over a Tek window
--------------------------------------------------
TABLE 4: Main Options Menu
-------------------------------------------------------------------------------------
Menu Item Action
-------------------------------------------------------------------------------------
Secure keyboard All keystrokes are sent to this xterm.
Allow SendEvents Allows events to be sent to an xterm.
Log to File Logs all input and output in the window to a file.
Redraw Window Redraws the window contents.
Send STOP Signal Suspends the current process.
Send CONT Signal Continues a stopped process.
Send INT Signal Interrupts a process.
Send HUP Signal Hangs up the process and kills the xterm.
Send TERM Signal Teminates the process without killing the xterm.
Send KILL Signal Kills xterm and all processes running in xterm.
Quit Kills the xterm.
-------------------------------------------------------------------------------------
From the upper section you can toggle (turn on or off) many window characteristics. If an option is in effect, a check mark appears next to it. You toggle an option by highlighting it with the mouse and releasing the mouse button (just like normal menu item selection). The different options are listed below, with explanations as appropriate.
TABLE 5: VT Options Menu (Continued)
-----------------------------------------------------------------------------------------------
Menu Item Action
-----------------------------------------------------------------------------------------------
Enable Scrollbar Turns on the scrollbar.
Enable Jump Scroll Makes the window move text several lines at a time
instead of one line at a time.
Enable ReverseVideo Displays white on a black background rather than black-
on-white.
Enable Auto Wraparound Wraps text which would run off the right margin onto
the next line.
Enable Auto Linefeed Adds a linefeed character after a carriage-return
(RETURN) character. UNIX terminals do not need this
toggle.
Enable Application Cursor Activates cursor keys, but they may not perform as
Keys expected if an application does not use them.
Enable Application Keypad Activates keypad, but it may not perform as expected if
an application does not exist.
Scroll to Bottom on Key Makes the window jump to the bottom when you type.
Press
Scroll to Bottom on tty Out Makes the window jump to the bottom when new output
put appears.
Allow 80/132 Column Permits some applications to switch between 80 and
Switching 132 character width.
Enable Cursor Emulation Corrects a VT bug that only affects some applications.
You probably do not need this option.
Enable Visual Bell Flashes the window once instead of sounding your ter
minal bell (beep).
Enable Margin Bell Sounds bell (beeps) when typed input approaches the
right margin.
Show Alternate Screen Indicates if you are looking at an alternate screen. You
cannot toggle it yourself.
Do Soft Reset Corrects scrolling if a program failed to reset it properly.
Do Full Reset Clears VT window, and returns VT Options to their
original settings.
Reset and Clear Saved Lines Clears lines saved in the scroll buffer and resets the
scrollbar thumb.
Show Tek Window Makes the Tek window visible.
Switch to Tek Mode Makes the Tek window active (input and output now
occur in the Tek window, not the VT window).
Hide VT Window Makes the VT window vanish, automatically switches
to the Tek window and Tek mode.
-----------------------------------------------------------------------------------------------
TABLE 6: VT Fonts Menu
--------------------------------------------------------------------
Menu Item Action
--------------------------------------------------------------------
Default Selects the starting xterm font size
Tiny Selects VT font size
Small Selects VT font size
Medium Selects VT font size
Large Selects VT font size
--------------------------------------------------------------------
TABLE 7: Tek Options Menu
----------------------------------------------------------------------------------------
Menu Item Action
----------------------------------------------------------------------------------------
Large Characters Selects Tek font size.
#2 Size Characters Selects Tek font size.
#3 Size Characters Selects Tek font size.
Small Characters Selects Tek font size.
PAGE Clears Tek Window.
RESET Clears Tek Window.
COPY Disabled. (Normally it writes a file of the Tek com
mands you have issued.)
Show VT Window Makes the VT window visible.
Switch to VT Mode Makes the VT window active (input and output now
occur in the VT window, not the Tek window).
Hide Tek Window Makes the Tek window vanish, automatically switches
to the VT window and VT mode.
----------------------------------------------------------------------------------------
One environment variable, DISPLAY, indicates to clients where to connect to your X server. X looks for DISPLAY so it can direct graphics to you.
Each DISPLAY variable has the following form:
For example, consider a color display server named tuna. An xterm displayed on the monochrome page has a DISPLAY of tuna.rice.edu:0.1. A different xterm which resides on the color page, has a DISPLAY of tuna.rice.edu:0.0.
On machines with only one screen it is possible to omit the screen number in the DISPLAY environment variable. In that case, the screen number is assumed to be zero.
printenv DISPLAY
If you are already at the display server wahoo, you will see:
wahoo.rice.edu:0.0
That is your DISPLAY environment variable, which tells X where to send output for your console.
printenv DISPLAY
Then enter the same command inside your xterm. You should see identical DISPLAY values. Note the server (including the .rice.edu). Now, still in your xterm, enter:
setenv DISPLAY server:1.2
Remember that you substitute your display's name (i.e. wahoo.owlnet.rice.edu) for server. Again enter printenv DISPLAY in the console and the xterm. Notice that the DISPLAY values differ now. To complete the exercise, reset the altered xterm's DISPLAY by entering:
setenv DISPLAY server:0.0
For example, suppose you have a project that requires a special computer which is not included on the same network as the computer account you are currently logged in to. First you obtain an account from the administrators of this computer (usually by filling out some forms). Rather than travelling to the special computer's physical location, you can rlogin from an IS terminal.
hostname
The window will return hostname, the name of your current host (wahoo, for example.) Now enter
rlogin hostname
(rlogin great-gray, for example). The xterm should display the greeting text that you see when you first login. You have just conducted a remote login.
When you rlogin from an xterm, UNIX creates a new environment inside the xterm's existing environment. However, this new environment lacks the DISPLAY variable. The absence of DISPLAY within the new environment occurs because the new environment is created purely by the UNIX system and without X's input.
printenv DISPLAY
The window should return nothing except a new UNIX prompt. This new environment does not have a DISPLAY value, so it prints nothing.
For most work inside the xterm you will not encounter problems. You can still perform operations like moving between directories, copying files, using the vi text editor, and compiling and running most programs.
However, any commands that start a new X client will fail. UNIX starts the new client, but X does not know where to send the graphics, so the client fails and terminates. This mishap occurs because does not exist.
puzzle &
Nothing happens, except that you receive an error message like the one below.
puzzle: unable to open display
[1] Exit 1 puzzle
Because the new environment created by your rlogin has no DISPLAY, X does not know where to send the puzzle graphics. Now, go to your console and enter:
puzzle &
This time you should get a little pocket-puzzle window. Since your console has a DISPLAY value, X can open a window for the puzzle.
To correct this missing DISPLAY problem, you can specify a display when you start a client, or you can add DISPLAY to the environment. The following exercises show you how.
printenv DISPLAY
to see your DISPLAY value (i.e., if you are working at wahoo, your-DISPLAY-value is wahoo.rice.edu:0.0). Return to the rlogin-ed xterm and enter:
puzzle -display your-DISPLAY-value &
The puzzle should appear normally because you specified DISPLAY when you started the client.
setenv DISPLAY your-DISPLAY-value
By doing so you add DISPLAY to the new environment. Now start a puzzle by entering:
puzzle &
Start another puzzle with the same command.
In Exercise 8, you indicate DISPLAY by using the -display your-DISPLAY-value option. Since you normally use only one display server, you may not want to type the
-display your-DISPLAY-value every time you start a client. Instead you can use the setenv DISPLAY your-DISPLAY-value command, as in Exercise 9, to put your display server into the new environment.
exit
Notice that the xterm window does not disappear because you only exited the rlogin-ed shell, not the xterm's inherent shell.
xhost maintains a list of allowed hosts. Adding or removing hosts from the list determines display access. However, your changes only affect subsequent display attempts. If a host is displaying a window and you then remove that host from the list, the window continues to operate normally, but the host cannot create any new windows. In other words, changing xhost does not affect existing windows, but it does affect subsequent ones.
To see this list, enter:
A message indicating whether access control is enabled appears, followed by a list of hosts. Note that your initial host (the computer to which you logged in) does not appear on this list.
Usually, you only want to permit your host computer or computers to affect your display.
To prevent a host from displaying information on your display, enter
To enable a host to display information, enter
For More Information
Hopefully this document has helped you become familiar and comfortable with X. For more information about X, consult the Consulting Center or the following sources.