The Linux Guide Online

Chapter 05 - The X-Window System

5.1 Introduction

The X Windowing system is such a vast and deep subject that any introduction to it will be very restricted even if details were to be touched upon. The history, the technology and the economics behind one of the most successful and customizable Windowing systems if fascinating to say the least. Here we will look at a little of all these topics so that you will have a feel of what you are dealing with, when using the X Windowing system on your Red Hat system.

Windows and Mac users must be used to seeing the same interface every time the computer boots, but for probably minor variations. This must be getting boring after some time. Linux and Unix users will definitely not feel the same. The X Window system, the Graphical User Interface (GUI) for Linux and Unix is an extremely powerful and flexible system. X Windows allows you to choose any graphical interface you would like to use. You can get one like the interface of Windows or Mac or you could get one totally and radically different.

The X Windowing system, or X for short, was developed at the Massachusetts Institute of Technology. It was developed n 1984 with the help of DEC (now a part of Compaq) and IBM. The objective was to develop an operating environment that could be run on any hardware platform. X is based on the Client-Server architecture and can run across the network, which means that it could run a host server located in Timbuktu and interact with your computer in Chennai. The X system is made of two components - the X server and the Client (the window managers). These components are completely independent of each other. Thus what you see can be totally left to the window manager and the backend performed by the server. This obviously means that any body can write a window manager and completely overhaul the look and feel of the interface. Also a number of combinations are possible between the two and the user can different results of feel and performance.

A free port of the MIT X system is now available for Linux under the name of XFree86. The version 11 release 6 (X11R6) for 80386, 80486 and Pentium machines was developed by a team of programmers originally headed by David Wexelblat. This release provides all the binaries, support files, libraries and tools for the required installation. The window manager you will use however depend on your choice. These will be investigated in detail in the next chapter.

Please note that to do most of the configurations detailed in this chapter will require the administrator privileges. Be sure to log in as root to be able to change the configuration files.

5.2 Setup and Configuring Xfree86

If you installed Red Hat Linux as discussed before and also completed the configuration of X to your satisfaction then this chapter is probably not for you. You will still gain by knowing how to change the configuration files etc. Here we will look at installing the X from scratch. Right from the installation of the required binaries to its configuration.

Installation of the X server is by installing the XFree86 rpms. Mount your CD-ROM and change to the rpms directory, which will typically be the following and install the rpm files.

$ mount /mnt/cdrom
$ cd /mnt/cdrom/RedHat/Rpms/
$ rpm -ivh XFree*.rpm

This will install the XFree86 software. You will find a series of directories as shown under the /usr/X11R6 tree

/usr/X11R6/bin - where most of the X11 clients are stored
/usr/X11R6/include - programming header files and directories of bitmaps and pixmaps.
/usr/X11R6/lib - X11 software libraries
/usr/X11R6/man - manual pages

Depending on the software installed this can take anywhere between 40 and 400 MB, and even more if you installed lots of X window managers.

The largest hurdle that many users face is coming up with a working version of the XF86Config file. If you already have a system working, chances are that your earlier file will work. But we will now try to get a new system to start working. The first thing that you have to do is red as much of documentation as possible. Just about all that you will need is under the /usr/X11R6/lib/X11/doc directory. Read also a XFree86-HOWTO under the /usr/doc/HOWTO directory. Also read the man pages for X and XFree86.

You also need some information about your hardware. Preferably get information about the video card, mouse and the keyboard before you begin. You can use one of the two tools available for the configuration. The xf86config is a text based wizard interface. The Xconfigurator has the advantage of providing a graphical interface (thereby sensitive to unknown cards) and also provide a lot of flexibility in choosing color depths and screen resolutions. (If you do not have these packages installed you may install them from the CD-ROM. They will have similarly named rpm files. Also install any dependant packages. The xf86config requires the VGA drivers to be present)

You are lucky if your hardware exactly matches the configuration provided by these programs. Problems can arise if you entered incorrect information or the chipset is not supported. You may rerun the configuration utility as many times till you are satisfied with the output. If your chipset is not supported you may have to buy one of the commercial X distributions from various vendors.

5.3 Xconfigurator

Red Hat's Xconfigurator produces an XF86Config file after it probes your system and gets information from you. Run the utility from command line

$ Xconfigurator

After selecting OK from the first screen you will be presented with the second screen where the program will probe for the video card and presents the results. If your card is listed, well and good. Otherwise you may have to get additional information and help for your card.

You will now be presented with a selection of monitors. If the program detects your monitor, you are luck and can expect exceptional performance from the X system. Otherwise scroll down and choose you monitor (or its nearest substitute, though a safer alternative will be to choose the custom monitor and configure it manually) from the list of about 200 monitors. If your monitor is not listed, choose the "custom" monitor.

You will then be presented an introductory dialog and then a list of monitor resolutions and frequencies. Check your monitor manual and choose the closest alternative. If the values do not exactly correspond to that of your monitor choose the closest ones and then change the values manually in the configuration file.

The next dialog asks you choose your vertical frequency range. Again select the closest one, which you can change later to suit your monitor exactly.

The next dialog asks you if you want to probe the monitor for resolution and color depth. Although the safest route is not to probe, those having an unlisted monitor will benefit because the program will automatically get some of the information it needs.

Select the amount of video RAM you have on the system. Interestingly no matter what you choose, the value will be inserted but will be left out commented. You will have to then enable it with hand. Also if you have memory more that the options listed you will have change it by hand.

Xconfigurator next asks you for the clockchip in your video system. If you are not sure whether your video card uses clockchip settings, select "No clockchip". If you are sure of the chip then choose one from those listed.

The next dialog lists the various video resolutions at different color depths. Select those that can be supported by your monitor. When you are finished, click the OK button.

Xconfigurator next saves your configuration file and exits.

Run startx and check if the configuration is correct. If your server runs but does not support high resolutions you may want to change the resolutions, probably sacrificing color depth for higher resolution.

5.4 XF86Config and .xinitrc

The configuration obtained earlier is stored in the file /etc/X11/XF86Config. This file is the entire source of information about your video subsystem. Just like any other configuration file, this too has the form that allows it to be both human readable and machine compatible. The file has several sections that define various values that the server should use while starting up. Be sure to have created at least a skeleton file as shown earlier before you go ahead and explore.

XF86Config Files Section
This section tells the X server where to get the color name database and the system database. There is normally no need to change the defaults.

XF86Config ServerFlags Section
These can be used to configure special actions allowed by your server. Enable a particular option by removing the "#" sign before it. (# implies a comment and will be ignored. Removing it will therefore cause the line to be read and processed next time the server starts.)

XF86Config Keyboard Section
This section tells the X server what kind of keyboard to expect, and other settings such as language type, key character layout, and manufacturer.

XF86Config Pointer Section
This tell the server what pointer, mouse to use and how the buttons are handled. The section varies for PS/2, bus and serial (auto) mice. Note that the device /dev/mouse is a symbolic link to the actual mouse device on the system. (such as say /dev/ttys0 for the serial mouse on COM1). Two-button mouse users will definitely want to enable the three-button emulator (clicking both the buttons at once acts like a third button click).

XF86Config Monitor Section
The first several parts are easy to understand. But if you have not been able to configure your video system here is the place you can learn about things that will allow you to try and get the configuration right. The monitor section contains specific details about your monitor, such as the name, horizontal and vertical sync ranges. In addition there are also a number of critical modelines that are what you need to change to fine-tune your X server. For more details see the files VideoModes.doc and README.Config under the /usr/X11R6/lib/X11/doc directory. Another good tutorial is the XFree86-Video-Timings-HOWTO under the HOWTOs directory.

The basic parts of a modeline are ten different values representing (from left to right)

  • A label of the screen resolution
  • A video frequency in mHz
  • The number of visible dots per line of your display
  • The Start Horizontal Retrace value (number of pulses before video sync pulse starts)
  • The End Horizontal Retrace value (end of the sync pulse)
  • The total number of visible and invisible display dots on your display
  • The Vertical Display End value (number of visible lines of dots on your display)
  • The Start Vertical Retrace value (number of line before the sync pulse starts)
  • The End Vertical Retrace value (number of lines at the end of the sync pulse)
  • The Vertical Total value (total number of visible and invisible lines on your display)

XF86Config Device Section
The device section contains details about your video chipset such as RAM or clockchips. You need to uncomment the line containing the VideoRam setting for it to be actually visible. This section of the configuration is critical, as it tells the server what exactly to expect from the video chipset.

XF86Config Screen Section
This section tells the X server what color depth and screen size to use (the bit depth and the resolution). This section contains for your chosen server (SVGA or VGA or MONO or any of the accelerated servers like the S3 or the Mach of the AGX etc) what resolutions and virtual screen sizes to support. In a particular session you can toggle resolutions using the Ctrl+Alt keys and the (+) or the (-) keys. The color depth can be chosen at the time of starting the X server as shown below.

$ startx -- -bpp 16

Starts a session in the 16-bit color mode.

The .xinitrc file

When the X server is started, details about which window manager to use and the other X clients to start can be found in a file called the .xinitrc in your home directory. A template file named xinitrc can be found /etc/X11/xinit directory which can be copied to your home directory (as a '.' file) and modified to suit your needs.

Although the file contains shell scripts logic to load in the system resources or to set environment variables, it is possible to write a file by hand that can be used instead.

The X Resource files

Most of the default settings for the various X clients are stored under the directory /usr/X11R6/lib/X11/app-defaults. These are text files that have a lot of configurable options, that can be changed. Any changes here affect the users on the whole system. You may also create a .Xresources file in your home directory and put the appropriate new values of the variable there for the different X clients. The format is described in detail in the X man page.

Booting by default into the GUI

This is achieved under Red Hat Linux by changing the following line in the /etc/inittab file
id:3:initdefault
to
id:5:initdefault
And be careful not to change any of the other entries while you are at this.

5.5 Troubleshooting

One of the best sources for information for troubleshooting can be found at the site www.xfree86.org. The FAQ there covers a lot of the problems faced by the users during installing and configuring the X server.