Configuring the X server

The X server is a network transparent windowing system. It allows X clients (graphical programs) to connect to it, either if they are run locally or from a remote location. So basically it's a program that shows programs on your screen. For a detailed description read: What Is the X Window System.

There multiple implementations of the X protocol specifications, the most popular under Linux are: X.org and XFree86 .

XFree86 has been the de facto standard for all Linux distributions for a very long time. But the 4.4rc2 release of XFree86, introduced a new revision of the license that XFree86 is distributed under, which made all major Linux distributions switch to X.org's implementation. X.org's version 6.7.0 is identical to XFree86 4.4rc2 + some minor updates. So X.org is a drop in replacement of XFree86.

Also check my guide on configuring fonts in X.

X configuration file

When I say "X configuration file", I mean one of the following files, located in /etc/X11/: (XFree86 files:) XF86Config, XF86Config-4 or (X.org file:) xorg.conf.

For more information:

[ Top | Bottom ]

Serverlayout

The serverlayout section of the X configuration files, makes it possible to have multiple configurations, using different combinations of input and output devices. These can be selected by starting the X server with startx -- -layout "name", else the top most in the configuration file will be used.

I use three different layouts: (see my X configuration file)

The most interesting are the "Framebuffer" and "Dualhead-Cloned" layouts.

The "Framebuffer" layout uses the resolution/color depth/frequency of the framebuffer. I use the Matrox framebuffer. This allows me to clone the main framebuffer onto the second head, on which I have a TV connected. So I'm able to run each X application I want, and be able to see it on my TV.

"Dualhead-Cloned" does almost the same as the "Framebuffer" layout, except it uses the "Xinerama" extensions to the X server. This extension allows a desktop to be cloned, or stretched to two displays. It is easy to setup, but lacks accelerated video output, and it does not fill the entire TV screen.

[ Top | Bottom ]

Resolution and color depth

To change the resolution of X open the configuration file, and look for the "Screen" Section. There you will see something like this:
Section "Screen"
	Identifier "screen0"
	Device     "Matrox Millennium G400"
	Monitor    "monitor0"
	DefaultDepth     24
	SubSection "Display"
		Depth     8
		Modes    "1024x768" "800x600" "640x480"  
	EndSubSection
	SubSection "Display"
		Depth     16
		Modes     "1600x1200" "800x600"  
	EndSubSection
	SubSection "Display"
		Depth     24
		Modes    "1600x1200" "1024x768" "800x600"
	EndSubSection
EndSection
Code listing 3.1
To change the default depth, edit the DefaultDepth line.
Each "Display" SubSection contains a Depth and a Modes line. The Modes line in the "Display" SubSection contains the default resolution for that color depth, in this case 24 is the default depth, which means the X server will start up in "1600x1200".
[ Top | Bottom ]

Change resolution while X is running

This depends on your version of XFree, in pre 4.3, you can press "ctrl alt +/-" to select another resolution. But this will only change the size of your "Viewport", and not your "Rootwindow". This means that you will still have you default size desktop, e.g. 1600x1200, but you can only see a part of it ("Viewport"), e.g. 1024x768 if you have selected that, and too see the rest of you desktop you can scroll around. This is not what most people want.

So in XFree 4.3 and X.org the xrandr extension was introduced. This extension enables users to, on the fly, change the resolution of their desktop ("Rootwindow"). You can use the simple commandline tool, xrandr to change the resolution, e.g. use xrandr -s 800x600 to change your resolution to 800x600.

For more information:

[ Top | Bottom ]

Custom resolution or frequency setting

Warning!: Do not use the example provided here, it could damage your monitor/graphics card!

If you want to specify the mode yourself, e.g. you want 800x600 @ 85Hz or something like that, you also need to calculate the modeline yourself. For this to work you need to know horizontal frequency range, and the vertical frequency range of your monitor.

Lucky for you there are some simple to use tools available. I recommend using The XFree86 Modeline Generator.

The generated modeline should be added to your X configuration file in the Modes section:
Section "Modes"
  Identifier "Modes0"
  Modeline "800x600@85" 58.20 800 832 1048 1080 600 611 620 631
EndSection
Code listing 5.1
You will also have to add
UseModes "Modes0"
Code listing 5.2
to your "Monitor" section, and finally add
Modes "800x600@85"
Code listing 5.3
to your "Display" subsection.

Newer monitors will probably switch off if they get a mode they can't handle, and if this happens, just switch to the console by pressing "ctrl alt F1" or to another mode with "ctrl alt +/-" and revert to your previous settings.

[ Top | Bottom ]

Adjusting mouse speed/acceleration

If you use KDE or Gnome they provide you with a GUI to adjust the mouse setting. For everybody else there is another way, called xset
xset m 3 4 # acceleration/threshold
Code listing 6.1
To make sure these setting are applied each time you log on to XFree, put the setting in ~/.xsession.

You can also change how the mouse "feels" by changing (or adding) the following to your X configuration file:

Section "InputDevice" 
    ...
    Option   "Resolution" "1200"
    ... 
EndSection
Code listing 6.2
This changes the accuracy, not the speed or the acceleration.
[ Top | Bottom ]
Hi! you have reached the old part of my homepage, be sure to checkout my new site, especially the Xorg section.