I just wrote this for addition to the Debian X FAQ, and thought I would
post it here since I've been getting asked about this lately.  Also,
it's a bit of signal to counter the noise I generated yesterday under
provocation from Jack Howarth.  :)

Needless to say, XF86Config(7), XF86Config-v3(5), and XF86Config-4(5)
are required reading for people who want to customize their XFree86
server configuration.

*) How do I add custom sections to a dexconf-generated XF86Config or
   XF86Config-4 file?

As of xfree86v3 3.3.6-42 and xfree86 4.1.0-10, the dexconf utility only
writes to part of the X server configuration file, instead of claiming
the entire file for itself.

For XFree86 3.x servers, this is mostly useful for adding XInput and
ServerFlags sections, and for replacing the Files and Modules sections
with something more to the user's liking.

For XFree86 4.x, this enables the replacement of the Files and Modules
sections, and the addition of an arbitrary number of supplementary
Device, InputDevice, Monitor, Screen, and ServerLayout sections.
Sections that are never written by dexconf (ServerFlags, VideoAdaptor,
Modes, and Vendor) can also be added, of course.

The most obvious application of this functionality is to support
additional input devices and multi-headed configurations, but another is
the replacement of, for instance, the Device section with something more
customized.  For instance, the driver for your video card may be buggy
and you may wish to add the 'Option "NoAccel"' flag to the Device
section for your video card.  Dexconf and the debconf questions
associated with it do not support the plethora of possible options (many
of them driver-specific), because it is not a very ambitious tool.

The number one fact to remember about the XFree86 4.x server is that the
first ServerLayout section encountered in the XF86Config-4 file is the
one that is used by default.  It is of course possible to add the
"-layout" option to server invocations, either manually or by
configuring xdm or xinit to do so by default (e.g., by editing
/etc/X11/xinit/xserverrc and/or /etc/X11/xdm/Xservers).

To implement the above example, then, I would add three sections to the
configuration file generated by debconf: a Device section with 'Option
"NoAccel", a Screen section to use that Device in conjunction with a
monitor, and a ServerLayout section to bind the Screen to input devices.
If I want my new ServerLayout to be the default, I'll put it at the top
of the XF86Config-4 file, before the debconf area.  The Device and
Screen sections can go either before or after the debconf area, but I'll
put them before just to keep my customizations together.  Also, I'll
remember to give my new sections unique identifiers so that they don't
collide with the identifiers used by debconf.

Example:

  Section "Device"
      Identifier        "Custom Device"
      Driver            "ati"
      Option            "NoAccel"
  EndSection

  Section "Screen"
      Identifier  "Custom Screen"
      Device      "Custom Device"
      Monitor     "Generic Monitor"
      DefaultDepth 24
      Subsection "Display"
          Depth       8
          Modes       "[EMAIL PROTECTED]" "[EMAIL PROTECTED]" "1024x768" 
"800x600" "640x480"
      EndSubsection
      Subsection "Display"
          Depth       16
          Modes       "[EMAIL PROTECTED]" "[EMAIL PROTECTED]" "1024x768" 
"800x600" "640x480"
      EndSubsection
      Subsection "Display"
          Depth       24
          Modes       "[EMAIL PROTECTED]" "[EMAIL PROTECTED]" "1024x768" 
"800x600" "640x480"
      EndSubsection
  EndSection

  Section "ServerLayout"
      Identifier        "Custom"
      Screen            "Custom Screen"
      InputDevice       "Generic Keyboard" "CoreKeyboard"
      InputDevice       "Configured Mouse" "CorePointer"
  EndSection

  ### BEGIN DEBCONF SECTION
[snip]
  ### END DEBCONF SECTION

Of course, my "Generic Monitor", "Generic Keyboard", and "Configured
Mouse" should be defined in the debconf section of the file, but the
identifier in the monitor section may be different, depending on what
dexconf wrote to the file.

-- 
G. Branden Robinson                |       The key to being a Southern
Debian GNU/Linux                   |       Baptist: It ain't a sin if you
[EMAIL PROTECTED]                 |       don't get caught.
http://people.debian.org/~branden/ |       -- Anthony Davidson

Attachment: pgpjpJcS06Qfr.pgp
Description: PGP signature

Reply via email to