MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


*DocIndex - X

Customizing X

* Color Depth
* Resolution
* Refresh Rate
* Power Saving
* Running Scripts Automatically

Related Resources:

X Free86 Video Timings HOWTO
man xset
man XF86Config

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


* 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"
Depth 32
Modes "1280x1024"
ViewPort 0 0

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 * top

* Resolution

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 <CTRL ALT -> or <CTRL ALT +>.

* section index * top

* 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 HorizSync and VertRefresh. Do not guess at these values! 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 * top

* 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:

  1. Environments like GNOME or KDE allow to enable and configure DPMS settings via their respective control centers.

  2. 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 * top

* 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 begin of every session.
First create a script. The script has to be executable and must start with this line:


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
xterm &
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 * top

Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.