Customizing X


  • Color Depth
  • Refresh Rate
  • Resolution
  • Power Saving
  • Running Scripts Automatically
  • Width Height Position
Section index - KB index

Color Depth


In Mandrake 7.0 and later, you can change resolution and color depth settings comfortably via '~DrakConf' (aka Mandrake Control Center). For earlier versions you may either run the 'Xconfigurator' or insert the values by hand in '/etc/X11/XF86Config(-4)' ('Screen Sections', Section 'Screen', 'Subsection Display'), like this

Subsection "Display"<br> Depth 32<br> Modes "1280x1024"<br> ~ViewPort 0 0<br> ~EndSubsection

This will start the X server with a resolution of 1280x1024 at a color depth of 32 bits per pixel (aka as 'True Color').

If you want to start X with a different color depth just for one session, type startx –– -bpp n with 'n' choosing the color depth (8, 16, 24 or 32). This only works if you boot to the console first.

Pro's and Con's of color depths

  • 256 colors (= 8 bits per pixel)
    Low memory load. Works with almost all graphic cards. However some programs (like Wordperfect) have problems with color mapping, don't start at all, look ugly or induce annoying color flashes when changing focus. If you use KDE, you should get rid of the icons which eat up a lot of the available colors. Economical, but not nice.
  • 32.768 or 65536 colors (= 15, 16 bpp)
    Moderate memory load (one third less than 24 bpp). Unfortunately, this seems to be the color depth which is most likely to cause problems with some cards. Reduced color precision due to dithering. Goes along well with applications. A good compromise for workstations. The 15 bpp setting is quite uncommon.
  • 16.777.216 colors (= 24 bpp)
    High memory load. An image at 1024x768 with 24 bpp uses more than 2 MB of memory. Top image quality. Problems with some programs (notably Netscape Communicator, which tends to display a black and white user interface at this depth).
  • 16.777.216 colors (= 32 bpp)
    See above. This depth has an 8bit pseudo layer added which is used by some graphics hard- and software. It's of no use in X, though, but some programs which have coloring difficulties with the 24bpp setting work flawlessly with this (again, Netscape Communicator).
    If you want to use ~TrueColor, use this mode instead of 24 bpp.
Changing the color depth 'on the fly' within X is - as far as I know - not possible. So if you change the color depth via the Mandrake Control Center or if you edit your '/etc/X11/XF86Config(-4) by hand, you have to restart the X server (log out and then log in again) to let the changes take effect.

section index


Common resolution settings are:

  • 800x600 for 15'' monitors,
  • 1024x768 for 17'' monitors,
  • 1280x1024 for 19'' monitors,
  • Up to 1800x1440 for bigger monitors.
15'' flat panels are like 17'' monitors in screen size and resolution.
Higher resolutions allow a smoother display of dithered colors but put a higher load on the graphics card and the monitor. Working comfortably in X requires at least an 17'' monitor (well, in my opinion ;-)), especially if you run desktop environments which come with task bars (like KDE or GNOME).

If you feel your screen is too small, you can make it appear larger in two ways : virtual desktops and virtual screen size.

Most of the available window managers for X allow you to have several (virtual) X desktops. Remember though that every virtual desktop uses system resources, so turn them off via the manager's configuration utility if you don't need them.
'Virtual screen size' means although your monitor's resolution is set to - let's say - 800x600, the desktop looks like 1024x768. It scrolls on its own accord as soon as the mouse reaches the edge of the real screen. You can set this up via '~DrakConf / Mandrake Control Center', the 'Xconfigurator' in older Mandrake releases or by hand in '/etc/X11/XF86Config(-4)', Screen Sections, Section "Screen", Subsection "Display" like this

Subsection "Display"
Depth 32
Modes "800x600" "640x480"
Virtual "1024x768"
~ViewPort 0 0

If you want to get rid of it, comment or remove these settings.

If your 'XF86Config(-4)' file supplies different resolution settings ('Modes'), X will always start with the first value. Within X you can switch resolutions by pressing or .

section index

Refresh Rate

The refresh rate determines how often the screen will be redrawn. Low refresh rates lead to the dreaded monitor flicker and are bad for your eyes and no fun to work with. The minimum is 75Hz for screens up to 17'', and 85Hz for bigger screens. So you'll need around 50 kHz horizontal sync frequency for 15'' monitors, 69kHz for 17'', and 95kHz for 19''. Of course, these are hardware values. If your monitor doesn't support them, you'll just have to cope with flicker.
The capabilities of your graphics card and the chosen screen resolution have an impact on this rate. You better use a lower resolution at a higher refresh rate than vice versa.

If you configure your screen settings via '~DrakConf / Mandrake Control Center' or - in older releases - with 'Xconfigurator' and your monitor is not listed in the database, you might have to choose generic settings which are safe but not as good as they could be.
To get the best out of your hardware, you have to change the appropriate lines in the 'Monitor Section' of '/etc/X11/XF86Config(-4)' by adjusting the values of

. Do not guess at these values1.1 Read your monitor's docs and make sure you put in the right values.

You can even tweak the modelines themselves, if you're brave enough. Read the XFree86 Video Timings ~HowTo for further information or get one of the several available modeline utilities.

section index

Power Saving

This is done via DPMS (Digital Power Management Signaling) and in most cases it is already enabled by an option in '/etc/X11/XF86Config-4'. To check if DPMS is enabled on your machine, run this command:

xdpyinfo | grep DPMS

If this command returns no output, you'll have to enable DPMS yourself.
This can be done in two ways:

  • Environments like KDE or GNOME allow to enable and configure DPMS settings via their respective control centers.
  • The 'xset' command line utility allows - among many other things - enabling and configuring DPMS settings. The syntax is simple:
xset dpms sec_till_standby sec_till_suspend sec_till_off

Put this line into your '~/.xinitrc' (when starting X from the console) or into your './.xsession', if you are booting directly to a graphical login screen. Notice that KDE and GNOME will ignore settings set this way, that's way they provide their own utility to do this.

section index

Running Scripts Automatically

Most window managers and desktop environment are capable of session management. This however works only for graphical applications, not for scripts.

If you start your window manager from the command line, just add the commands to the file '.xinitrc'. Read the article on Starting X for details.

KDE and GNOME offer mechanisms to run scripts automatically at the beginning of every session.
First create a script. The script has to be executable and must start with this line:


#1.1 /bin/sh

Now put your commands in there (like

xmodmap ~/.Xmodmap
for example), each command on one line. Save and make the script executable:

chmod +x file

In KDE, copy this script to the '~/.kde/Autostart' folder. In GNOME, open the Command Center, then the 'Session' menu and tell it where the script is you want to be executed at login. In Window Maker, enter the path to the script into the file '~/GNUstep/Library/~WindowMaker/autostart'.

If you start other window managers via a graphical login manager like KDM or GDM, create a file '~/.Xclients', put all the commands you want to be executed automatically in there. If the command starts a graphical application, put a '&' at the end of the command line, separated by a space. The last line has to execute the window manager. Example:

xmodmap ~/.Xmodmap<br> xterm &<br> exec icewm

Make the file executable with chmod +x .Xclients. Log out. On the graphical login screen, choose 'default' as the session type and log in. This will execute the '.Xclients' file and start your manager.
If you're using the 'autologin' feature, the procedure is exactly the same, but the name of the file has to be '.xinitrc' again instead of '.Xclients'.

section index

Width Height Position

Changing of the width, height and position of the desktop on the screen because of:

  • black borders
  • desktop is cut at one side
  • desktop is too big for the screen
Open a command windows and type the following:
su -
enter your password
XFree86 -version

Using this version information you have to choose your XF86Config-file. In the case of Mandrake 9 and 10 this is the following, if you have installed XFree version 4:
cp /etc/X11/XF86Config-4 /etc/X11/XF86Config.bak
vi /etc/X11/XF86Config-4

Or if you prefer a gui, you can use the konqueror to open the file /etc/X11/XF86Config-4. Search the Section "Monitor" and change to the parameters to those of you monitor from the handbook of your manufacturer. Do not change the Identifier, if you do not know what you are doing. see Refresh Rate

Section "Monitor"
    Identifier "monitor1"
    ~VendorName "Generic"
    ~ModelName "1024x768 @ 70 Hz"
    ~HorizSync 30-82
    ~VertRefresh 50-120
    # Sony Vaio C1(X,XS,VE,VN)?
    # 1024x480 @ 85.6 Hz, 48 kHz hsync
    ~ModeLine "1024x480"    65.00 1024 1032 1176 1344   480  488  494  563 -hsync -vsync

In the other window type xvidtune. The monitor configuration application will be started. Click on the buttons Left, Right, Wider and Narrower with a following Apply. If your desktops fits into the screen as you like it, you press on the Show button. Notice that this will print out the correct parameter settings for your monitor. Press the Quit button of xvidtune. In the editor window you add now a line ~ModeLine with your graphical resolution (HDisplay and VDisplay in xvidtune) and the last output of this program. Do not copy the text from here but use the settings of your environment1.1 For example:

Section "Monitor"
    Identifier "monitor1"
    ~VendorName "Generic"
    ~ModelName "1024x768 @ 70 Hz"
    ~HorizSync 30-82
    ~VertRefresh 50-120
    ~ModeLine "1024x768"     75.00   1024 1056 1192 1328    768  771  777  806 -hsync -vsync

This settings are necessary, because the changes by xvidtune would be lost at the next restart. If the graphical environment will not start the next boot-up, you know that something has went wrong. Copy back your original configuration and try again. cp /etc/X11/XF86Config.bak /etc/X11/XF86Config-4
vi /etc/X11/XF86Config-4

section index

Related Resources:

X Free86 Video Timings HOWTO
man xset
man XF86Config

Revision / Modified: June 18, 2002
Author: Tom Berger

Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.

KB - Customizing X
Versio montrenda 1.6 last modified by Flink on 21/01/2005 at 19:35

Kreinto: AdminWiki on 2004/03/22 09:45
(c) Mandriva 2007