In this lesson, you will learn the basics of the X Windows GUI in addition to enough information to get you started on configuring and customizing your environment.
Although most flavors of UNIX can be accessed via a command-line interface from the console, there is also an easier way. On top of the command-line interface, a variety of graphical-user-interfaces (GUIs) are available. A few of these GUIs are proprietary, but the majority conform to an open-standard interface called the X Window System, or X Windows. Some manufacturers have extended the X Windows standard with proprietary enhancements. Unfortunately, these enhancements can cause parts of the interface to be incompatible with remote display on other varieties of UNIX. Because the general principles are similar, though, you’ll find that a familiarity with one GUI translates well to the others.
Unlike the Macintosh and MS-Windows environments, X Windows is a system that provides a set of interface display functions.
Caution:
X Marks the Spot X Windows is usually referred to as X#, where # is the major revision number; or, you might come across X#Rn, where # is the major revision number and n is the minor revision. As of this writing, X11R6 is the current version, but it is generally referred to as X11—or, more simply, just X.
X Windows provides facilities for programs to display windows, buttons, and other user-interactive widgets. It is actually implemented as a type of server program running on the computer. Client programs that want to make use of X Windows display functionality make requests to the server, asking it to perform certain display functions. It does not matter to either the client or server application whether they are running on the same machine or are separated by miles of network—the client makes display requests and the server tries to honor them.
An additional difference between personal computer windowing systems and X Windows is that the interface’s look and feel is controlled by a separate program rather than by the X Windows server. In the X Windows model, the X server is responsible for handling client display requests such as requests for displaying windows. However, unless a client specifically draws a title bar for itself, X won’t give it one. A separate program must be run to create title bars and to actually manage user interactions such as moving windows around, iconizing/minimizing windows, or providing application-dock functionality.
On many UNIX boxes, the system administrator has configured X so that it starts automatically when the machine boots. If your system does not automatically start X, then you need to start it manually after you log in. The two most common ways to do this are the program xinit and a shell script called variably startx, x11, or xstart. If you’re on a plain-vanilla Solaris box, you might have to use /usr/openwin/bin/openwin. startx (and its variants) is usually a shell script that automates some of the calls to xinit. This is a good place to start browsing if you’re curious about how things are done and what options are available. (Shell scripts are covered in Lesson 14, “Basic Shell Scripting.”)
After the X server itself starts, you need to start some X applications. Usually, a default set of these is started by the automatic execution of the file .xinitrc located in your home directory. Some variants of UNIX don’t use this file, or they use it in counter-intuitive ways. For example, IRIX uses .xinitrc if it’s present; if not, IRIX uses its own proprietary configuration utility. Some variants of Linux use files named ****.m4. Your system administrator can change the default configuration. If you can’t find .xinitrc, you might find that your system remembers what windows you have open and where they are positioned between logins “automagically.”
The .xinitrc file—if present—contains a series of lines similar to the following:
#!/bin/sh xrdb -load $HOME/.X11defaults xscreensaver -timeout 10 & xterm -geometry 80x30+10+10 &
If this in fact was your .xinitrc file, when you started X11 the .xinitrc file would:
You’ll see more examples of command-line options to X programs later in this lesson.