Generally, you won’t need to manually configure X. The installation procedure and Xconfigurator generally configure X automatically. However, automatic configuration sometimes fails. In that case, it’s handy to know how to configure X manually.
This section explains a typical X configuration file,
/etc/X11/XF86Config
, of the sort created by
Xconfigurator. You can use the information in this section to tweak
your X configuration. However, it’s not recommended that you do
so; if possible, you should use Xconfigurator to generate your
system’s X configuration file. The real value of this section
is in helping you understand how X works.
The X configuration file, like almost all Linux configuration files, is a text file and can be viewed or edited by using a text editor. The typical file has seven main sections:
This section identifies files that specify colors and specify or contain fonts.
This section specifies flags that control X server operation.
This section specifies the keyboard.
This section specifies the mouse or other pointing device. Unlike Windows, X cannot be used without a pointing device.
This section specifies the monitor.
This section specifies the video adapter.
This section specifies the X display, by referencing monitor and device specifications and providing additional specifications.
Several of the sections can appear multiple times in the X configuration file. For example, a system with multiple video adapters could have multiple Device sections in its X configuration file. The XF86Config manpage describes the contents of the X configuration file in detail. However, it describes a newer file format than that used by Xconfigurator; the older format is still accepted, but not documented. The following subsections give an overview of the file.
Here is an excerpt from a typical
Files section. The lines beginning with a hash mark
(#
) are comments and are not processed by X. Only
two configuration items—RgbPath
and
FontPath
—are present.
Section "Files" # The location of the RGB database. Note, this is the name of the # file minus the extension (like ".txt" or ".db"). There is normally # no need to change the default. RgbPath "/usr/X11R6/lib/X11/rgb" # Multiple FontPath entries are allowed (they are concatenated together) # By default, Red Hat 6.0 and later now use a font server independent of # the X server to render fonts. FontPath "unix/:7100" EndSection
RgbPath
gives the path of a file that contains
names for commonly used colors. The actual name of the file is
rgb.txt
, not merely rgb
.
Here is an excerpt from the file:
255 250 250 snow 248 248 255 ghost white 248 248 255 GhostWhite 245 245 245 white smoke 245 245 245 WhiteSmoke
The file uses three numbers to represent a color, via the so-called RGB color scheme. The numbers represent the amount of red, green, and blue in a color. The numbers range from 0 to 255. The RGB value 0,0,0 corresponds to black, whereas the RGB value 255,255,255 corresponds to white. The color called snow is very nearly white.
FontPath
can specify paths containing font files.
However, Red Hat Linux uses the X Font Server. So, instead of font
paths, what appears is merely a reference to the font server, which
operates on port 7100.
The typical
ServerFlags
section contains nothing but comments.
Here’s an example:
Section "ServerFlags" # Uncomment this to cause a core dump at the spot where a signal is # received. This may leave the console in an unusable state, but may # provide a better stack trace in the core dump to aid in debugging #NoTrapSignals # Uncomment this to disable the <Crtl><Alt><BS> server abort sequence # This allows clients to receive this key event. #DontZap # Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching # sequences. This allows clients to receive these key events. #DontZoom EndSection
The Keyboard
section specifies the configuration items related to the keyboard. As
explained by the comments in the Keyboard
section,
you can use keyboard configuration items to alter the operation of
control keys, such as the Alt key. You can also specify the model and
layout of the keyboard. However, you’ll likely need to install
special fonts to be able to use variant keyboard types. Therefore,
it’s much easier to use Xconfigurator than to attempt to hack
the configuration file.
Here’s a typical Keyboard
section:
Section "Keyboard" Protocol "Standard" # When using XQUEUE, comment out the above line, and uncomment the # following line #Protocol "Xqueue" AutoRepeat 500 5 # Let the server do the NumLock processing. This should only be # required when using pre-R6 clients #ServerNumLock # Specify which keyboard LEDs can be user-controlled (eg, with xset(1)) #Xleds 1 2 3 #To set the LeftAlt to Meta, RightAlt key to ModeShift, #RightCtl key to Compose, and ScrollLock key to ModeLock: LeftAlt Meta RightAlt Meta ScrollLock Compose RightCtl Control # To disable the XKEYBOARD extension, uncomment XkbDisable. # XkbDisable # To customise the XKB settings to suit your keyboard, modify the # lines below (which are the defaults). For example, for a non-U.S. # keyboard, you will probably want to use: # XkbModel "pc102" # If you have a US Microsoft Natural keyboard, you can use: # XkbModel "microsoft" # # Then to change the language, change the Layout setting. # For example, a German layout can be obtained with: # XkbLayout "de" # or: # XkbLayout "de" # XkbVariant "nodeadkeys" # # If you'd like to switch the positions of your capslock and # control keys, use: # XkbOptions "ctrl:swapcaps" # These are the default XKB settings for XFree86 # XkbRules "xfree86" # XkbModel "pc101" # XkbLayout "us" # XkbVariant "" # XkbOptions "" XkbKeycodes "xfree86" XkbTypes "default" XkbCompat "default" XkbSymbols "us(pc101)" XkbGeometry "pc" XkbRules "xfree86" XkbModel "pc101" XkbLayout "us" EndSection
The Pointer
section specifies the mouse or other pointing device. The most
important configuration items are Protocol
and
Device
. Here’s a typical
Pointer
section:
Section "Pointer" Protocol "Microsoft" Device "/dev/mouse" # When using XQUEUE, comment out the above two lines, and uncomment # the following line. # Protocol "Xqueue" # Baudrate and SampleRate are only for some Logitech mice # BaudRate 9600 # SampleRate 150 # Emulate3Buttons is an option for 2-button Microsoft mice # Emulate3Timeout is the timeout in milliseconds (default is 50ms) Emulate3Buttons Emulate3Timeout 50 # ChordMiddle is an option for some 3-button Logitech mice # ChordMiddle EndSection
The Protocol
configuration item specifies the
protocol used by the pointing device. Most modern PC mice, including
recent Logitech mice, use the Microsoft protocol. However, other
protocols are supported, including:
PS/2
BusMouse
Various serial mouse protocols
To learn more about mouse protocols supported by X, view the file
/usr/X11R6/lib/X11/doc/README.mouse
, which is
part of the XFree86-doc
package.
The Device
configuration item simply specifies the
device file associated with the pointing device.
If you have a two-button mouse, you should generally specify the
Emulate3Buttons
configuration item, which lets you
simulate pressing a middle mouse button by simultaneously pressing
the left and right mouse buttons.
The Monitor
section contains several important configuration items. Several
Monitor
sections can be present, one for each of
several monitors. Here’s an example configuration:
Section "Monitor" Identifier "ViewSonic 17GS" VendorName "Unknown" ModelName "Unknown" # HorizSync is in kHz unless units are specified. # HorizSync may be a comma separated list of discrete values, or a # comma separated list of ranges of values. # NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S # USER MANUAL FOR THE CORRECT NUMBERS. HorizSync 30-69 # VertRefresh is in Hz unless units are specified. # VertRefresh may be a comma separated list of discrete values, or a # comma separated list of ranges of values. # NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S # USER MANUAL FOR THE CORRECT NUMBERS. VertRefresh 50-160 # Modes can be specified in two formats. A compact one-line format, or # a multi-line format. # These two are equivalent # ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace # Mode "1024x768i" # DotClock 45 # HTimings 1024 1048 1208 1264 # VTimings 768 776 784 817 # Flags "Interlace" # EndMode # This is a set of standard mode timings. Modes that are out of monitor spec # are automatically deleted by the server (provided the HorizSync and # VertRefresh lines are correct), so there's no immediate need to # delete mode timings (unless particular mode timings don't work on your # monitor). With these modes, the best standard mode that your monitor # and video card can support for a given resolution is automatically # used. <lines omitted> # 800x600 @ 100 Hz, 64.02 kHz hsync Modeline "800x600" 69.65 800 864 928 1088 600 604 610 640 -HSync -VSync # 800x600 @ 56 Hz, 35.15 kHz hsync ModeLine "800x600" 36 800 824 896 1024 600 601 603 625 # 800x600 @ 60 Hz, 37.8 kHz hsync Modeline "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync # 800x600 @ 72 Hz, 48.0 kHz hsync Modeline "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync # 800x600 @ 85 Hz, 55.84 kHz hsync Modeline "800x600" 60.75 800 864 928 1088 600 616 621 657 -HSync -VSync <lines omitted> EndSection
The following lines:
Identifier "ViewSonic 17GS" VendorName "Unknown" ModelName "Unknown"
serve to identify the monitor. Only the Identifier
configuration item is important; it’s used to refer to the
monitor.
The following lines:
HorizSync 30-69 VertRefresh 50-160
give the horizontal and vertical sync rates for the monitor. Sometimes, Xconfiguratorwill pick a value that’s not quite right. Tweaking these values can turn a nonworking X configuration into a working one. Be sure, however, to specify only values consistent with the capabilities of your monitor; otherwise, you may damage it.
Perhaps the most important configuration item in the
Monitor
section is the
ModeLine
. Typically, there are many
ModeLine
entries, at least one for each video mode
supported by the monitor. The example Monitor
section shows only a handful of typical entries.
The format of a ModeLine
entry is:
ModeLine name clock horizontal vertical options
The parameters have the following meanings:
name
An arbitrary name assigned to the entry
clock
The horizontal sync rate of the related video mode
horizontal
and
vertical
Four numbers each, representing the timing of the sync pulses
options
Can include a variety of options
Most monitors can use the Video Electronics Standards Association (VESA) modes that Xconfigurator includes in the configuration file it generates. If your monitor isn’t cooperative, you have several alternatives:
Download the latest XFree86 distribution from http://www.xfree86.org. There, you can find
two files that give ModeLines
for monitors or show
you how to determine your own:
modeDB.txt
, which gives entries for many monitors
VideoModes.doc
, which explains how to determine
ModeLine
values
Use the program xvidtune to generate
one or more suitable ModeLine
entries. See the
program’s manpage for more information.
The Device
section specifies the video adapter. Multiple device sections can be
present. Here’s a typical Device
section:
# Device configured by Xconfigurator: Section "Device" Identifier "Matrox Millennium" VendorName "Unknown" BoardName "Unknown" #VideoRam 4096 Option "sw_cursor" # Insert Clocks lines here if appropriate. EndSection
The Identifier
configuration item assigns a name
to the Screen section that contains it. The
VendorName
and BoardName
configuration items are unimportant. The VideoRam
configuration item specifies the amount of video memory installed on
the device; it is generally commented out, since X can probe for the
values of most configuration items in the Device
section. The Option
configuration item is used to
specify a variety of options needed to support video adapter
features.
A typical X configuration file
contains multiple Screen
sections. Each section
specifies a combination consisting of a monitor, video adapter, and X
server. Here’s a typical section:
# The Colour SVGA server Section "Screen" Driver "svga" Device "Matrox Millennium" Monitor "ViewSonic 17GS" DefaultColorDepth 16 Subsection "Display" Depth 16 Modes "1280x1024" "1152x864" "1024x768" "800x600" ViewPort 0 0 EndSubsection Subsection "Display" Depth 24 Modes "1152x864" "1024x768" "800x600" ViewPort 0 0 EndSubsection Subsection "Display" Depth 32 Modes "1152x864" "1024x768" "800x600" ViewPort 0 0 EndSubsection EndSection
The Driver
configuration item identifies the X
server. Possible values are:
Mono
For the non-VGA drivers of the XF86_Mono
and
XF86_VGA16
servers
SVGA
For the XF86_SVGA server
VGA2
For the XF86_Mono server
VGA16
For the XF86_VGA16 server
Accel
For the remaining, accelerated X servers
The Device
and Monitor
configuration items refer back to entries in the
Device
and Monitor
sections.
The remaining configuration items specify video modes. These give the default color depth and the resolutions permissible for each video mode.