Next Previous Contents

2. Getting Started

2.1 The X Window System: History and Architecture

The X Window System was developed in the Laboratory for Computer Science at the Massachusetts Institute of Technology, as part of project Athena in cooperation with DEC, and first released in 1984. The project lead of the main development was Robert Scheifler, and the origins of X owe much debt to the ``W'' Windowing package, developed by Paul Asente at Stanford. In September of 1987, MIT issued the first release of the X11 that we know and use today. As of X11R2, control passed from MIT to the X Consortium, formed in January of 1988.

Many of the ideas that went into X Window also came from research at Xerox Corporation's Palo Alto Research Center (PARC), where they were working on computers like the Parc and the Star in the late seventies. None of these computers made it to market, but when Xerox demonstrated a window system custom built to run Smalltalk 80, people were hooked. These series of three computers demonstrated the WIMP (Windows, Icons, Menus, Pointer) interface so well that it spawned a revolution in computing almost overnight. Within a few years many computer users got a taste of a windowing system of some kind, and you might say they never looked back.

X Window is currently developed and distributed by the X Consortium, however, a liberal license permits the existence of free and low-cost implementations. The version of X used on Linux is XFree86. XFree86 is a collection of X servers for UNIX-like OSs on Intel x86 platforms. The work is derived from X386, and much of it is contributed back into X11R6 thereafter. We can think of XFree86, for all intents and purposes, to be X Window for Linux, unless you have purchased another X server.

X Window is built upon a great many toolkits, or libraries. It is built upon the X Toolkit Intrinsics and the Athena Widgets. Many programs use XView or Motif tools. More still are part of a newer, unified windowing and communication system, like GNOME or KDE. If you find many of your programs not compiling, or are getting strange and inexplicable errors, you may wish to make sure that you have installed X correctly, because most of these libraries (with the exception of Motif) are free and most likely preinstalled with X on your system.

And remember, it's called X Window, not X Windows!

2.2 Anatomy of Your Desktop

There are a few basic principles and terms you should familiarize yourself with to make using X much more straightforward. These terms will appear over and over again in the manual pages and help files, which it is suggested that you consult whenever necessary.

The screen is your whole ``desktop'', and the words may be used interchangeably. Technically it means the primary video display you view X with, and you can have more than one screen, in fact you can have more than one computer running off a single X server. This is beyond the scope of this humble document, but you should be aware of the distinction.

The root window is the background of your screen. It is referred to a window in name alone, it does not behave like any other window, but rather you run your applications on the root window, or put a picture on it, or just a solid color.

The window manager is the main interface between the X Window system and the user. Without the window manager, the system would be rather difficult to use, and would certainly not be a very productive tool. The window manager provides such functionality as window borders, menus, icons, virtual desktops, button bars, tool bars, and allows the user to customize it at will, often adding to its functionality in the process.

The pointer is the arrow or indicator of any given shape which represents the location your mouse (or other pointing device) corresponds to on the screen. The pointer often changes to give you contextual feedback as to what will happen when you use the mouse at that point on the screen.

The window is a frame in which any given application resides which is ``managed'' by the window manager. This includes pretty much anything except the so-called root window. Even windows which do not appear to have frames, titles, or normal borders of any kind are being managed by your window manger. The active window is the window you are currently using, the window that will receive text when you type, and is traditionally denoted by the fact that your mouse cursor is pointing at it, though this is not always the case. The active window is said to have ``focus,'' the rest of the windows on your display being ``unfocused.''

Menus and icons behave in X similar to the way they behave in other windowing systems, and the same general principles apply. Windows with text only are called terminal emulators, an example would be xterm, and these basically emulate a console text-only display, but let you multiplex and use more than one at a time, and have many other advantages available due to their being used in X. We shall discuss many of these later on.

2.3 Invoking X Window

Starting X can be done in several ways. On your system it may be set up to start automatically, and you will not need to read this section. Most Linux systems, however, presently start at the command line upon login, and you have to decipher this for yourself.

The most basic way to start X is with xinit. This will put you at a blank desktop, by default, and with no window manager loaded. If no client program is specified on the command line, xinit will look for the .xinitrc file to run as a shell script, to start up client programs. If this file does not exist, xinit will use the following command as a default:

 xterm -geometry +1+1 -n login -display :0
 

As you see, this is not very helpful. The most common way to start X is with the command startx. This is the most civilized fashion to start the windowing system, but requires that you log in from a text shell, and start the windowing system yourself. For many Linux users this is the most common way to start X, it is also the most flexible. You can issue commands such as the following:

 startx -- -bpp 8    #start x in 256 color mode
 startx -- -bpp 32   #start x in true color mode
 

The double dashes pass arguments directly to xinit, and this way you can start up X in the resolution your work will require, and still have it use the configuration files we will cover later in this document.

2.4 The X Display Manager

The program xdm provides similar services to getty and login, which allow users to log into a system and start their basic shell. If you start X with xdm, however, users need only to type in their username and password at a friendly prompt, and they are dropped directly into the graphical environment. This is simple and easy to use, and is seen frequently in college campuses, cyber cafes, business environments, anywhere you have users not necessarily familiar with Unix to any great extent.

xdm can be configured with configuration files located in /usr/X11R6/lib/X11/xdm on your Linux system. The file xdm-config is for configuring how the login screen appears to users, and Xsetup_0 is used to tell xdm what programs should be launched when X is started. Some of the configuration a normal user would put in their .xinitrc file should go in here, if xdm is to be normally used.

Here is a sample Xsetup_0 file to look at, which might help to configure your system. The xfstt program is the TrueType font server, and is discussed later in this document. Also, notice that we're using a shell script here, and it's trying to call xv to set the background to a nice picture (instead of the boring black and white background pattern), and if that call fails, xsetroot is called, to at least try to set the background to a nice blue color.

 #!/bin/sh
 xconsole -geometry 480x100-0-0 -daemon -notify -verbose -fn \
 '-schumacher-clean-medium-r-*-*-10-*-*-*-*-*-*-*' -exitOnFail
 /usr/X11R6/bin/xfstt &
 /usr/X11R6/bin/xv -quit -root                               \
 /usr/local/share/WindowMaker/Backgrounds/InDreams.jpg       \
 || xsetroot -solid darkblue
 xset fp+ unix/:7100
 

Many distributions of Linux include this facility automatically. If you are able to look at the run levels for your Linux system, you can probably see that run level 3 is the normal startup (look under /etc/rc.d) unless you're booting into something like xdm. If you are, you're going to be starting in run level 5. This is something of a standard on Linux (and similar) systems. Programs such as linuxconf and its functional equivalents should be able to adjust this.

Also on many newer Linux systems are facilities such as gdm and kdm, which are GNOME and KDE aware equivalents of this program. Primarily, this just changes the look and feel to suit your desktop preferance, but often these other versions contain more features, such as remembering which desktop environment you last logged in to, the ability to shutdown and reboot from the console, and so forth.


Next Previous Contents