xorg.conf

From Gentoo Wiki
Jump to: navigation, search

The xorg.conf is the main configuration file of the X server.

Note
The xorg.conf should be seen as a "last resort" option. It's really desirable to run without any special configuration if possible. If you still can't get a working configuration, then read on.

xorg.conf.d, xorg.conf

The X server read the settings from the files in /etc/X11/xorg.conf.d/ (recommended) or the legacy /etc/X11/xorg.conf. Each file is given a unique name and ends in .conf. If the filenames start with a number, then the X server will read the files in numeric order. 10-evdev.conf will be read before 20-synaptics.conf, and so on. You don't have to give them numbers, but it may help you organize them.

The settings in /etc/X11/xorg.conf take precedence over the files in /etc/X11/xorg.conf.d/, which take precedence over the files in /usr/share/X11/xorg.conf.d/, which take precedence over the built-in X server configuration.

x11-base/xorg-server provides example configurations in /usr/share/doc/xorg-server-*/xorg.conf.example.bz2. You can use these to create your own configuration files in /etc/X11/xorg.conf.d/.

Syntax

The configuration is composed of a number of sections. The most common ones are:

  • ServerFlags: Common X server settings
  • InputClass: Settings for input devices
  • Device: Settings for graphics cards
  • Monitor: Settings for displays
  • Screen: Settings for "graphics card / display"-combinations
  • ServerLayout: Settings for "screen / input devices"-combinations

Lines starting with a hash (#) are comments and are ignored by the X server. Each other line in a section define a value to an option. The value can be of the following types:

  • INTEGER: an integer number in decimal, hex or octal, e.g. 1, 2, 3, etc.
  • REAL: a floating point number, e.g. 1.2
  • STRING: a string enclosed in double quote marks ("), e.g. "Hello world!"

Most options and values are case-insensitive. Superfluous white spaces are ignored.

The special option named Option accepts also the additional types:

  • BOOLEAN: a boolean value, e.g. on, true, 1 or yes; off, false, 0 or no.
  • FREQUENCY: in Hz, k, kHz, M or MHz

Note also that the Option values must be enclosed in double quote marks (").

Sections

ServerFlags

An example ServerFlags section looks like this:

File/etc/X11/xorg.conf

Section "ServerFlags"
   Option "OffTime" "5"
   ...
EndSection

All entries are optional.

The most common options are:

Option Default Description
Option "AutoAddDevices" "BOOLEAN" true Enables or disables the automatic detection of input devices using udev.
Option "OffTime" "INTEGER" 10 Turns off the monitor after the given time (in minutes) of inactivity.

For more information see the xorg.conf man page.

InputClass

Create for each input device class (keyboard, mouse, etc.) a InputClass section. An example InputClass section looks like this:

File/etc/X11/xorg.conf

Section "InputClass"
   Identifier   "My Keyboard"
   MatchIsKeyboard "True"
   ...
EndSection

Identifier is mandatory, everything else is optional.

Without specify a matching condition a InputClass section applies to all input devices. Add a matching condition to apply settings only to input devices of the target class or to a single device. The most common conditions are:

Condition Description
MatchIsKeyboard "BOOLEAN" Match only keyboards
MatchIsPointer "BOOLEAN" Match only mice
MatchIsJoystick "BOOLEAN" Match only joysticks
MatchIsTablet "BOOLEAN" Match only tablets
MatchIsTouchpad "BOOLEAN" Match only touchpads
MatchIsTouchscreen "BOOLEAN" Match only touchscreens
MatchProduct "STRING" Match only devices with the given product name.
MatchVendor "STRING" Match only devices with the given vendor name.

The most common options are:

Option Default Description
Identifier "STRING" none Specify an unique name
Driver "STRING" none Specify the input device driver, see the input device articles.
Option "Ignore" "BOOLEAN" false Disable the input device (useful for e.g. sensors)
Option "XkbLayout" "STRING" en Specify a keyboard layout.
Option "XkbVariant" "STRING" Specify a keyboard layout variant
Option "XkbOptions" "STRING" Specify keyboard layout options

For more information see the xorg.conf man page and the man pages of your input device drivers.

Device

Create for each graphics card a Device section. An example Device section looks like this:

File/etc/X11/xorg.conf

Section "Device"
   Identifier   "My Graphics Card"
   Driver       "intel"
   ...
EndSection

Identifier and Driver is mandatory, everything else is optional.

The most common options are:

Option Default Description
Identifier "STRING" none Specify an unique name
Driver "STRING" none Specify the graphics driver, see the graphics drivers articles.
BusID "STRING" none For multiple graphics cards specify the BusID in the form PCI:bus:device:function provided by scanpci.
Option "Accel" "STRING" driver/card dependent Specify a 2D acceleration system
Option "Monitor-OUTPUT" "STRING" none Force bind a Monitor section to this device. OUTPUT is a connector name, see xrandr, and STRING is the choosen identifier of the Monitor section.

For more information see the xorg.conf man page and the man pages of your graphics drivers.

Monitor

Create for each monitor a Monitor section. An example Monitor section looks like this:

File/etc/X11/xorg.conf

Section "Monitor"
   Identifier   "My Monitor"
   ...
EndSection

Identifier is mandatory, everything else is optional.

The most common options are::

Option Default Description
Identifier "STRING" none Specify an unique name
DisplaySize INTEGER INTEGER EDID Specify the physical width and height (in millimeters) of the monitor. It will be used to calculate the DPI.
Modeline "STRING" ... EDID Specify a new mode entry.
Option "Enable" "BOOLEAN" true Enables or disables the monitor by default.
Option "PreferredMode" "STRING" none Specify the default mode.

For more information see the xorg.conf man page.