Xorg configuration

From Elvanör's Technical Wiki
Jump to navigation Jump to search

Xorg on Gentoo

  • With xorg-server-1.5.4, if you have the hal USE flag enabled, you must configure your input devices via evdev (at the kernel level) and they are autodiscovered / added by HAL. If you disable the hal USE flag, you will use the old way of setting those via the xorg.conf configuration file.

Initial Xorg configuration

  • You can use X -configure, xorgconfig, or xorgcfg. I recommand to use X -configure which creates an useful skeleton file that you can then edit to suit you needs.

Display Drivers

Nvidia Drivers

  • Current (November 2019) binary drivers support KMS (Kernel Mode Setting), but this is an option that must be activated at boot (warning: this is not mentioned at all in Gentoo's nvidia wiki article). Add the following kernel parameter in GRUB or in the built-in kernel command line:
nvidia-drm.modeset=1

Intel Drivers

  • It is important to follow all instructions in the official Gentoo Intel wiki. For recent graphic processors, following points must be checked:
    • USE="glamor vaapi"
    • VIDEO_CARDS="intel i965"
    • Compile required firmware into the kernel. Of course, also build required kernel modules.
    • Add an xorg.conf file: 20-modesetting.conf.

Keyboard Layout

  • With the current setup (evdev, without HAL), to specify the correct layout create a file /etc/X11/xorg.conf.d/30-keyboard.conf and write the following:
Section "InputClass"
        Identifier "keyboard-all"
        Driver "evdev"
        Option "XkbLayout" "fr"
        Option "XkbModel" "pc105"
        Option "XkbRules" "xorg"
        MatchIsKeyboard "on"
EndSection

Obsolete information

  • You should add the following lines to the Xorg configuration file to allow the login window (before KDE is started) to use the correct layout:
       Option "XkbLayout"      "fr"
       Option "XkbModel"       "pc105"

Note that a list of layouts can be found in /etc/usr/share/X11/xkb/symbols.

HAL / evdev

  • You can remove the mouse and keyboard X11 drivers if you're using evdev.
  • If you use the evdev driver (you should with xorg-server-1.5.3 and later), the options in xorg.conf are not used. Instead you must create a HAL policy file (/etc/hal/fdi/policy/10-X11-input.fdi):
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
        <match key="info.capabilities" contains="input.keyboard">
                <merge key="input.x11_options.XkbLayout" type="string">fr</merge>
        </match>
</device>
<device>
        <match key="info.capabilities" contains="input.mouse">
                <merge key="input.x11_driver" type="string">evdev</merge>
                <merge key="input.x11_options.Emulate3Buttons" type="string">false</merge>
                <merge key="input.x11_options.YAxisMapping" type="string">5 4</merge>
                <merge key="input.x11_options.Buttons" type="string">8</merge>
        </match>
</device>
</deviceinfo>
  • Note: this file is actually not needed, Xorg will work perfectly without it but may pick a wrong keyboard layout for instance.

Screen

DPMS

  • To manually put the screen to sleep, the best is to create a small script (in /usr/local/opt/bin for example) containing the following command:
xset dpms force off
  • This script can then be easily associated with a keyboard shortcut on KDE.

Xrandr

  • With recent version of Xorg, manual configuration of the xorg.conf file is almost no longer needed. Xrandr kicks in, retrieves information from the monitor and configures Xorg accordingly.
  • The HorizSync, VertRefresh, Modes and Modeline options have been deprecated (although Modeline can still be used with the Option "Preferred Mode"); the only thing that is currently needed now is the Virtual option.
  • The xrandr command line is quite useful.
  • Not sure if this information is still actual, but old (February 2009) binary drivers did not support XRandR 1.2. RandR will appear to be enabled in the Xorg logs, but running xrandr will never show more than the main screen. To use multiple monitors the best is to use the proprietary TwinView Nvidia feature. It is best to use this via the nvidia-settings GUI application. This won't modify the Xorg configuration files.

Xorg and Window Managers

  • X11 itself has no notion of maximized windows. Thus for instance using chromium --start-maximized won't work when just using X / Xvfb. Installing Openbox (a minimal WM) fixes this problem (note that twm for some reason won't work correctly).

X Forwarding via SSH

  • You need to have the following line in /etc/ssh/sshd_config on the server (remote end):
X11Forwarding yes
  • Then you just log in via ssh with the -X switch:
ssh -X -l root valinor.kameleoon.net

Any application launched that will need an X server will use your local X server.

  • If it fails for security reasons (and the error "Invalid MIT-MAGIC-COOKIE-1"), try using -Y instead of -X:
ssh -Y root@valinor.kameleoon.net

Bugs

  • Current Intel X drivers (2.9) have a bug in GEM that makes logout kill X (you return to the console instead of returning to KDM). One workaround is to set TerminateServer=true option in /usr/kde/3.5/share/config/kdm/kdmrc. UPDATE: This has now been fixed.