Difference between revisions of "Xorg"

From ArchWiki
Jump to: navigation, search
(Composite: Page is empty now.)
(simplification and beautification of wikilinks (interactive))
(Tag: wiki-scripts)
 
(271 intermediate revisions by 55 users not shown)
Line 1: Line 1:
[[Category:X Server]]
+
[[Category:X server]]
 +
[[Category:Graphics]]
 
[[cs:Xorg]]
 
[[cs:Xorg]]
 
[[da:Xorg]]
 
[[da:Xorg]]
Line 13: Line 14:
 
[[ro:Xorg]]
 
[[ro:Xorg]]
 
[[ru:Xorg]]
 
[[ru:Xorg]]
[[tr:X_Sunucusu]]
+
[[tr:X Sunucusu]]
 
[[zh-CN:Xorg]]
 
[[zh-CN:Xorg]]
 
[[zh-TW:Xorg]]
 
[[zh-TW:Xorg]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|An all-inclusive overview about installing and managing Xorg}}
+
{{Related|Start X at login}}
{{Article summary heading|Overview}}
+
{{Related|Autostarting}}
{{Article summary text|{{Graphical user interface overview}}}}
+
{{Related|Display manager}}
{{Article summary heading|Related}}
+
{{Related|Window manager}}
{{Article summary wiki|Start X at Login}}
+
{{Related|Font configuration}}
{{Article summary wiki|Execute commands after X start}}
+
{{Related|Cursor themes}}
{{Article summary wiki|Login Manager}}
+
{{Related|Desktop environment}}
{{Article summary wiki|Window Manager}}
+
{{Related|Wayland}}
{{Article summary wiki|Font Configuration}}
+
{{Related|Mir}}
{{Article summary wiki|X11 Cursors}}
+
{{Related|Xinitrc}}
{{Article summary wiki|Get All Mouse Buttons Working}}
+
{{Related articles end}}
{{Article summary wiki|Desktop Environment}}
+
From http://www.x.org/wiki/:
{{Article summary wiki|Wayland}}
+
:The X.Org project provides an open source implementation of the X Window System. The development work is being done in conjunction with the freedesktop.org community. The X.Org Foundation is the educational non-profit corporation whose Board serves this effort, and whose Members lead this work.
{{Article summary heading|Free Video Drivers}}
+
{{Article summary wiki|Intel Graphics}}
+
{{Article summary wiki|ATI}}
+
{{Article summary wiki|Nouveau}}
+
{{Article summary heading|Proprietary Video Drivers}}
+
{{Article summary wiki|AMD Catalyst}}
+
{{Article summary wiki|NVIDIA}}
+
{{Article summary end}}
+
  
'''Xorg''' is the public, open-source implementation of the X window system version 11. Since Xorg is the most popular choice among Linux users, its ubiquity has led to making it an ever-present requisite for GUI applications, resulting in massive adoption from most distributions. See the [[Wikipedia:X.Org Server|Xorg]] Wikipedia article or visit the [http://www.x.org/wiki/ Xorg website] for more details.
+
'''Xorg''' is the most popular display server among Linux users. Its ubiquity has led to making it an ever-present requisite for GUI applications, resulting in massive adoption from most distributions. See the [[Wikipedia:X.Org Server|Xorg]] Wikipedia article or visit the [http://www.x.org/wiki/ Xorg website] for more details.
  
==Installation==
+
== Installation ==
First, you will need to [[pacman|install]] the X server with the package {{Pkg|xorg-server}}, available in the [[Official Repositories]]. You may also want the useful utilities contained in the {{Grp|xorg-apps}} group.
+
  
[[Udev]] will detect your hardware and [[Wikipedia:evdev|evdev]] will act as the hotplugging input driver for almost all devices. [[Udev]] is provided by {{Pkg|systemd}} and {{Pkg| xf86-input-evdev}} is required by {{Pkg|xorg-server}}, so there is no need to explicitly install those packages.
+
Xorg can be [[install]]ed with the {{Pkg|xorg-server}} package.
  
{{Tip|The default X environment is rather bare, and you will typically seek to install a [[Window Manager|window manager]] or a [[Desktop Environment|desktop environment]] to supplement X.}}
+
Additionally, some packages from the {{Pkg|xorg-server-utils}} meta-package are necessary for certain configuration tasks, they are pointed out in the relevant sections. Other useful packages are in the {{Grp|xorg-apps}} group.
  
==Running==
+
{{Tip|You will typically seek to install a [[window manager]] or a [[desktop environment]] to supplement X.}}
''See also: [[Start X at Login]]''
+
  
{{Tip|The easiest way to start X is by using a [[Display Manager|display manager]] such as [[GDM]], [[KDM]] or [[SLiM]].}}
+
=== Driver installation ===
  
If you want to start X without a display manager, install the package {{Pkg|xorg-xinit}}. Optionally, the packages {{Pkg|xorg-twm}}, {{Pkg|xorg-xclock}} and {{Pkg|xterm}} allows for a default environment, as described below.
+
The Linux kernel includes open-source video drivers and support for hardware accelerated framebuffers. However, userland support is required for OpenGL and 2D acceleration in X11.
  
The {{ic|startx}} and {{ic|xinit}} commands will start the X server and clients (the {{ic|startx}} script is merely a front end to the {{ic|xinit}} command). To determine the client to run, {{ic|startx}}/{{ic|xinit}} will first look to parse a {{ic|~/.xinitrc}} file in the user's home directory. In the absence of {{ic|~/.xinitrc}}, it defaults to the global file {{ic|/etc/X11/xinit/xinitrc}}, which defaults to starting a basic environment with the [[Twm]] window manager, [[Wikipedia:Xclock|Xclock]] and [[Xterm]].
+
First, identify your card:
  
{{Note|X must always be run on the same tty where the login occurred, to preserve the logind session. This is handled by the default {{ic|/etc/X11/xinit/xserverrc}}.}}
+
$ lspci | grep -e VGA -e 3D
  
{{Warning|If you choose to use {{ic|xinit}} instead of {{ic|startx}}, you are responsible for passing {{ic|-nolisten tcp}} and ensuring the session does not break by starting X on a different tty.}}
+
Then install an appropriate driver. You can search the package database for a complete list of open-source video drivers:
  
For more information, see [[xinitrc]].
+
$ pacman -Ss xf86-video
  
{{Note|
+
Xorg searches for installed drivers automatically:
* If a problem occurs, then view the log at {{ic|/var/log/Xorg.0.log}}. Be on the lookout for any lines beginning with {{ic|(EE)}}, which represent errors, and also {{ic|(WW)}}, which are warnings that could indicate other issues.
+
* If there is an ''empty'' {{ic|.xinitrc}} file in your {{ic|$HOME}}, either delete or [[xinitrc|edit it]] in order for X to start properly. If you do not do this X will show a blank screen with what appears to be no errors in your {{ic|Xorg.0.log}}. Simply deleting it will get it running with a default X environment.}}
+
  
== Configuration ==
+
* If it cannot find the specific driver installed for the hardware (listed below), it first searches for ''fbdev'' ({{pkg|xf86-video-fbdev}}).
{{Note|Arch supplies default configuration files in {{ic|/etc/X11/xorg.conf.d}}, and no extra configuration is necessary for most setups.}}
+
* If that is not found, it searches for ''vesa'' ({{pkg|xf86-video-vesa}}), the generic driver, which handles a large number of chipsets but does not include any 2D or 3D acceleration.
 +
* If ''vesa'' is not found, Xorg will fall back to [[kernel mode setting]], which includes GLAMOR acceleration (see {{ic|man modesetting}}).
  
=== Using split files ===
+
In order for video acceleration to work, and often to expose all the modes that the GPU can set, a proper video driver is required:
The {{ic|/etc/X11/xorg.conf.d/}} directory stores user-specific configuration. You are free to add configuration files to {{ic|/etc/X11/xorg.conf.d/}}, but they must start with {{ic|XX-}} (where XX is a number) and have a {{ic|.conf}} suffix (10 is read before 20, for example). These files are parsed by the X server upon startup and are treated like part of the traditional  xorg.conf configuration file. The X server essentially treats the collection of configuration files as one big file with entries from  xorg.conf at the end.
+
  
=== Using single file ===
+
{| class="wikitable"  style="text-align:center"
Xorg can also be configured via {{ic|/etc/X11/xorg.conf}} or {{ic|/etc/xorg.conf}}. You can also generate skeleton for the xorg.conf by
+
|-
  # Xorg :0 -configure
+
! Brand !! Type !! Driver !! OpenGL !! OpenGL ([[Multilib]]) !! Documentation
 +
|-
 +
| rowspan="3" {{R|'''AMD/<br/>ATI'''}} || rowspan="2" | Open source || {{Pkg|xf86-video-amdgpu}} || rowspan="2" | {{Pkg|mesa-libgl}} || rowspan="2" | {{Pkg|lib32-mesa-libgl}} || [[AMDGPU]]
 +
|-
 +
| {{Pkg|xf86-video-ati}} || [[ATI]]
 +
|-
 +
| Proprietary || {{AUR|catalyst}} || {{AUR|catalyst-libgl}} || {{AUR|lib32-catalyst-libgl}} || [[AMD Catalyst]]
 +
|-
 +
| {{C|'''Intel'''}} || Open source || {{Pkg|xf86-video-intel}} || {{Pkg|mesa-libgl}} || {{Pkg|lib32-mesa-libgl}} || [[Intel graphics]]
 +
|-
 +
| rowspan="4" {{G|'''Nvidia'''}} || Open source || {{Pkg|xf86-video-nouveau}} || {{Pkg|mesa-libgl}} || {{Pkg|lib32-mesa-libgl}} || [[Nouveau]]
 +
|-
 +
| rowspan="3" | Proprietary || {{Pkg|nvidia}} || {{Pkg|nvidia-libgl}} || {{Pkg|lib32-nvidia-libgl}} || rowspan="3" | [[NVIDIA]]
 +
|-
 +
| {{Pkg|nvidia-340xx}} || {{Pkg|nvidia-340xx-libgl}} || {{Pkg|lib32-nvidia-340xx-libgl}}
 +
|-
 +
| {{Pkg|nvidia-304xx}} || {{Pkg|nvidia-304xx-libgl}} || {{Pkg|lib32-nvidia-304xx-libgl}}
 +
|}
  
That should create an {{ic|xorg.conf.new}} file in {{ic|/root/}} that you can copy over to {{ic|/etc/X11/xorg.conf}} for more information see {{ic|man xorg.conf}}  
+
{{Note|For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see [[NVIDIA Optimus]] or [[Bumblebee]].}}
  
Alternatively, your video card drivers may come with a tool to automatically configure Xorg. In the case of NVIDIA, try nvidia-xconfig. For ATI with the proprietary driver, try aticonfig.
+
Other video drivers can be found in the {{Grp|xorg-drivers}} group.
  
{{Note| Config  file  keywords  are  case-insensitive, and  “_” characters are ignored.  Most strings (including Option names) are also  case-insensitive, and insensitive to white space and “_” characters.}}
+
Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games.
  
==Input devices==
+
=== ATI ===
Installing input drivers is not needed for most hardware. Nevertheless, if evdev does not support your device, install the needed driver from the {{Grp|xorg-drivers}} group (try {{ic|pacman -Sg xorg-drivers}} for a listing).
+
  
You should have {{ic|10-evdev.conf}} in the {{ic|/etc/X11/xorg.conf.d}} directory, which manages the keyboard, the mouse, the touchpad and the touchscreen.
+
{| class="wikitable"  style="text-align:center"
 +
|-
 +
! GPU architecture !! Radeon cards !! Open-source driver !! Proprietary driver
 +
|-
 +
| GCN 4<sup>3</sup> || RX 400 || [[AMDGPU]] || [[AMDGPU#AMDGPU PRO|AMDGPU PRO]]
 +
|-
 +
| GCN 3 || [[Wikipedia:List of AMD graphics processing units|various]] || [[AMDGPU]] || [[Catalyst]] /<br/>[[AMDGPU#AMDGPU PRO|AMDGPU PRO]]
 +
|-
 +
| GCN 2 || [[Wikipedia:List of AMD graphics processing units|various]] || [[ATI]]<sup>2</sup> || [[Catalyst]]<sup>2</sup>
 +
|-
 +
| GCN 1 || [[Wikipedia:List of AMD graphics processing units|various]] || [[ATI]]<sup>1</sup> || [[Catalyst]]<sup>1</sup>
 +
|-
 +
| TeraScale 2&3 || HD 5000 - HD 6000 || rowspan=3 | [[ATI]] || [[Catalyst]]
 +
|-
 +
| TeraScale 1 || HD 2000 - HD 4000 || [[Catalyst]] legacy
 +
|-
 +
| Older || X1000 and older || ''not available''
 +
|-
 +
|}
 +
: <sup>1</sup>: [https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-SI-Experimental-Code experimental AMDGPU support coming in Linux 4.8]
 +
: <sup>2</sup>: [https://www.phoronix.com/scan.php?page=news_item&px=AMD-AMDGPU-Released experimental AMDGPU support]
 +
: <sup>3</sup>: {{pkg|linux}}>=4.7
  
===Touchpad Synaptics===
+
== Running ==
''Main page: [[Touchpad Synaptics]]''
+
  
If you have a laptop, you need to [[pacman|install]] the touchpad driver provided by the {{Pkg|xf86-input-synaptics}} package in the [[Official Repositories]].
+
=== Display manager ===
  
After installation, you can find {{ic|10-synaptics.conf}} in the {{ic|/etc/X11/xorg.conf.d}} directory. It is safe to comment out/delete the {{ic|InputClass}} line regarding the touchpad in {{ic|10-evdev.conf}}.
+
A convenient way to start X, but one that requires an additional application and dependencies, is by using a [[display manager]].
  
===Disabling input hot-plugging===
+
=== Manually ===
Since version''' 1.8''' Xorg-server uses udev for device detection. The following will disable the use of udev.
+
To start the X server without a display manager, see [[xinit]].
  
Section "ServerFlags"
+
== Configuration ==
    Option          "AutoAddDevices" "False"
+
EndSection
+
{{Warning|This will disable Xorg hot-plugging for '''all''' input devices and revert to the same behavior as xorg-server 1.4. It is much more convenient to let udev configure your devices. '''Therefore, disabling hot-plugging is not recommended!'''}}
+
  
===Keyboard settings===
+
{{Note|Arch supplies default configuration files in {{ic|/usr/share/X11/xorg.conf.d}}, and no extra configuration is necessary for most setups.}}
  
Xorg may fail to detect your keyboard correctly. This might give problems with your keyboard layout or keyboard model not being set correctly.
+
Xorg uses a configuration file called {{ic|xorg.conf}} and files ending in the suffix {{ic|.conf}} for its initial setup: the complete list of the folders where these files are searched can be found at [http://www.x.org/releases/current/doc/man/man5/xorg.conf.5.xhtml] or by running {{ic|man xorg.conf}}, together with a detailed explanation of all the available options.
  
To see a full list of keyboard models, layouts, variants and options, open {{ic|/usr/share/X11/xkb/rules/xorg.lst}}.
+
=== Using .conf files ===
  
To set the keymap for the current Xorg session:
+
The {{ic|/etc/X11/xorg.conf.d/}} directory stores host-specific configuration. You are free to add configuration files there, but they must have a {{ic|.conf}} suffix: the files are read in ASCII order, and by convention their names start with {{ic|''XX''-}} (two digits and a hyphen, so that for example 10 is read before 20). These files are parsed by the X server upon startup and are treated like part of the traditional {{ic|xorg.conf}} configuration file. The X server essentially treats the collection of configuration files as one big file with entries from {{ic|xorg.conf}} at the end.
  
$ setxkbmap dvorak
+
For option examples to set, see also the [http://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d fedora wiki].
  
====Key repeat delay and rate====
+
=== Using xorg.conf ===
  
Use {{ic|xset r rate DELAY RATE}} to change them, then use [[xinitrc]] to make it permanent. Values 170 and 30 are a good start point.
+
Xorg can also be configured via {{ic|/etc/X11/xorg.conf}} or {{ic|/etc/xorg.conf}}. You can also generate a skeleton for {{ic|xorg.conf}} with:
  
====Viewing keyboard settings====
+
# Xorg :0 -configure
  
{{hc|$ setxkbmap -print -verbose 10|<nowiki>
+
This should create a {{ic|xorg.conf.new}} file in {{ic|/root/}} that you can copy over to {{ic|/etc/X11/xorg.conf}}.
  
Setting verbose level to 10
+
{{Tip|If you are already running an X server, use a different display, for example {{ic|Xorg :2 -configure}}.}}
locale is C
+
Applied rules from evdev:
+
model:      evdev
+
layout:    us
+
options:    terminate:ctrl_alt_bksp
+
Trying to build keymap using the following components:
+
keycodes:  evdev+aliases(qwerty)
+
types:      complete
+
compat:    complete
+
symbols:    pc+us+inet(evdev)+terminate(ctrl_alt_bksp)
+
geometry:  pc(pc104)
+
xkb_keymap {
+
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
+
        xkb_types    { include "complete"      };
+
        xkb_compat    { include "complete"      };
+
        xkb_symbols  { include "pc+us+inet(evdev)+terminate(ctrl_alt_bksp)"    };
+
        xkb_geometry  { include "pc(pc104)"    };
+
};</nowiki>}}
+
  
====Setting keyboard layout with hot-plugging====
+
Alternatively, your proprietary video card drivers may come with a tool to automatically configure Xorg: see the article of your video driver, [[NVIDIA]] or [[AMD Catalyst]], for more details.
  
{{Note|If you use [[GNOME]], these settings will be ignored. You will have to set the keyboard layout from the GNOME Keyboard applet. Follow the Keyboard Layout link and add the layout you require and remove any you do not. For XkbOptions, see [[GNOME#Modify_Keyboard_with_XkbOptions]].}}
+
{{Note|Configuration file keywords are case insensitive, and "_" characters are ignored. Most strings (including Option names) are also case insensitive, and insensitive to white space and "_" characters.}}
  
To change your keyboard layout, create a {{ic|''number''-*.conf}} file (e.g. {{ic|10-keyboard.conf}}) with the following content:
+
== Input devices ==
  
{{hc|/etc/X11/xorg.conf.d/10-keyboard.conf|
+
For input devices, the virtual package ''xf86-input-driver'' ensures at least one input driver of either {{Pkg|xf86-input-evdev}} or {{Pkg|xf86-input-libinput}} is installed.[https://www.archlinux.org/news/xorg-1180-enters-testing/]
Section "InputClass"
+
    Identifier            "Keyboard Defaults"
+
    MatchIsKeyboard   "yes"
+
    Option           "XkbLayout" "us"
+
    Option                "XkbVariant" "colemak"
+
EndSection}}
+
  
Alternatively, you can also combine {{ic|XkbLayout}} and {{ic|XkbVariant}}:
+
[[Udev]], which is provided as a systemd dependency, will detect your hardware and both drivers will act as hotplugging input driver for almost all devices, as defined in the default configuration files {{ic|10-evdev.conf}} and {{ic|60-libinput.conf}} in the {{ic|/usr/share/X11/xorg.conf.d/}} directory.
  
{{hc|/etc/X11/xorg.conf.d/10-keyboard.conf|
+
After starting X server, the log file will show which driver hotplugged for the individual devices (note the most recent log file name may vary):
Section "InputClass"
+
$ grep -e "Using input driver " ~/.local/share/xorg/Xorg.0.log
    Identifier            "Keyboard Defaults"
+
    MatchIsKeyboard   "yes"
+
    Option           "XkbLayout" "us(colemak)"
+
EndSection}}
+
  
====Setting keyboard layout without hot-plugging (deprecated)====
+
If both do not support a particular device, install the needed driver from the {{Grp|xorg-drivers}} group. The same applies, if you want to use another driver.
  
{{Note|Changing the keyboard layout through this method requires disabling input hot-plugging.}}
+
To influence hotplugging, see [[#Configuration]].  
  
To change the keyboard layout, use the XkbLayout option in the keyboard InputDevice section. For example, if you have a keyboard with the English (Great Britain) layout, your keyboard InputDevice section might look similar to this:
+
For specific instructions, see also the [[libinput]] article, the following pages below, or the [https://fedoraproject.org/wiki/Input_device_configuration Fedora wiki] entry for more examples.
  
Section "InputDevice"
+
=== Mouse acceleration ===
    Identifier            "Keyboard0"
+
    Driver                "kbd"
+
    Option                "XkbLayout" "gb"
+
EndSection
+
  
To change the keyboard model, use the XkbModel option in the keyboard InputDevice section. For example, if you have a Microsoft Wireless Multimedia Keyboard:
+
See [[Mouse acceleration]].
  
Option "XkbModel" "microsoftmult"
+
=== Extra mouse buttons ===
  
====Switching between keyboard layouts====
+
See [[All Mouse Buttons Working]].
  
To be able to easily switch keyboard layouts, modify the Options used in either of the above two methods. For example, to switch between a US and a Swedish layout using the {{Keypress|Caps Lock}} key, create a file {{ic|/etc/X11/xorg.conf.d/01-keyboard-layout.conf}} with the following content:
+
=== Touchpad ===
  
Section "InputClass"
+
See [[Synaptics]] or [[libinput]].
        Identifier            "keyboard-layout"
+
        MatchIsKeyboard        "on"
+
        Option "XkbLayout"    "us, se"
+
        Option "XkbOptions"    "grp:caps_toggle"
+
EndSection
+
  
As an alternative, you can add the following to your {{ic|.xinitrc}}:
+
=== Touchscreen ===
  
setxkbmap -layout "us, se" -option "grp:caps_toggle"
+
See [[Touchscreen]].
  
This is mainly useful if you run a Desktop Environment which does not take care of keyboard layouts for you.
+
=== Keyboard settings ===
  
{{Tip|If you want to get a list of possible values for the layout and options, you can find them in {{ic|/usr/share/X11/xkb/rules/xorg.lst}}. They are under sections {{ic|! layout}} and {{ic|! option}} respectively. These values work for both the configuration file solution, and the command line alternative.}}
+
See [[Keyboard configuration in Xorg]].
  
====Enable pointerkeys====
+
== Monitor settings ==
  
[[Wikipedia:Mouse keys|Mouse keys]] is now disabled by default and has to be manually enabled:
+
=== Getting started ===
  
{{hc|/etc/X11/xorg.conf.d/20-enable-pointerkeys.conf|<nowiki>Section "InputClass"
+
{{Note|Newer versions of Xorg are auto-configuring, you should not need to use this.}}
    Identifier            "Keyboard Defaults"
+
    MatchIsKeyboard        "yes"
+
    Option                "XkbOptions" "keypad:pointerkeys"
+
EndSection</nowiki>}}
+
 
+
You can also run:
+
 
+
$ setxkbmap -option keypad:pointerkeys
+
 
+
Both will make the {{Keypress|Shift+Num Lock}} shortcut toggle mouse keys.
+
 
+
===InputClasses ===
+
'''Taken from: https://fedoraproject.org/wiki/Input_device_configuration'''
+
 
+
InputClasses are a new type of configuration section that does not apply to a single device but rather to a class of devices, including hotplugged devices. An InputClass section's scope is limited by the ''matches'' specified &ndash; to apply to an input device, all matches must apply to a device. An example InputClass section is provided below:
+
 
+
{{bc|
+
Section "InputClass"
+
    Identifier            "touchpad catchall"
+
    MatchIsTouchpad        "on"
+
    Driver                "synaptics"
+
EndSection
+
}}
+
 
+
The next snippet might also be helpful:
+
{{bc|
+
Section "InputClass"
+
        Identifier            "evdev touchpad catchall"
+
        MatchIsTouchpad        "on"
+
        MatchDevicePath        "/dev/input/event*"
+
        Driver                "evdev"
+
EndSection
+
}}
+
 
+
If this snippet is present in the {{ic|xorg.conf}} or xorg.conf.d, any touchpad present in the system is assigned the synaptics driver. Note that due to precedence order (alphanumeric sorting of xorg.conf.d snippets) the Driver setting overwrites previously set driver options &ndash; the more generic the class, the earlier it should be listed. The default snippet shipped with the {{pkg|xorg-x11-drv-Xorg}} package is {{ic|00-evdev.conf}} and applies the evdev driver to all input devices.
+
 
+
The match options specify which devices a section may apply to. To match a device, all match lines must apply. The following match lines are supported (with examples):
+
* {{ic|MatchIsPointer}}, {{ic|MatchIsKeyboard}}, {{ic|MatchIsTouchpad}}, {{ic|MatchIsTouchscreen}}, {{ic|MatchIsJoystick}} &ndash; boolean options to apply to a group of devices.
+
* {{ic|MatchProduct "foo&#124;bar"}}: match any device with a product name containing either "foo" or "bar"
+
* {{ic|MatchVendor "foo&#124;bar&#124;baz"}}: match any device with a vendor string containing either "foo", "bar", or "baz"
+
* {{ic|MatchDevicePath "/dev/input/event*"}}: match any device with a device path matching the given patch (see fnmatch(3) for the allowed pattern)
+
* {{ic|MatchTag "foo&#124;bar"}}: match any device with a tag of either "foo" or "bar". Tags may be assigned by the config backend &ndash; udev in our case &ndash; to label devices that need quirks or special configuration.
+
 
+
An example section for user-specific configuration is:
+
 
+
{{bc|
+
Section "InputClass"
+
    Identifier            "lasermouse slowdown"
+
    MatchIsPointer        "on"
+
    MatchProduct          "Lasermouse"
+
    MatchVendor            "LaserMouse Inc."
+
    Option                "ConstantDeceleration" 20
+
EndSection
+
}}
+
 
+
This section would match a pointer device containing "Lasermouse" from "Lasermouse Inc." and apply a constant deceleration of 20 on this device &ndash; slowing it down by factor 20.
+
 
+
Some devices may get picked up by the X server when they really should not be. These devices can be configured to be ignored:
+
 
+
{{bc|
+
Section "InputClass"
+
    Identifier            "no need for accelerometers in X"
+
    MatchProduct          "accelerometer"
+
    Option                "Ignore" "on"
+
EndSection
+
}}
+
 
+
====Example configurations====
+
 
+
The following subsections describe example configurations for commonly used configuration options. Note that if you use a desktop environment such as GNOME or KDE, options you set in the xorg.conf ''may'' get overwritten with user-specific options upon login.
+
 
+
=====Example: Wheel emulation (for a Trackpoint)=====
+
 
+
If you own a computer with a Trackpoint (a Thinkpad, for example) you can add the following to the {{ic|xorg.conf}} to use the middle button to emulate a mouse wheel:
+
 
+
{{bc|
+
Section "InputClass"
+
    Identifier            "Wheel Emulation"
+
    MatchIsPointer        "on"
+
    MatchProduct          "TrackPoint"
+
    Option                "EmulateWheelButton" "2"
+
    Option                "EmulateWheel" "on"
+
EndSection
+
}}
+
 
+
For full support of TrackPoints (including horizontal scrolling) you can use the following:
+
{{bc|<nowiki>
+
Section "InputClass"
+
    Identifier            "Trackpoint Wheel Emulation"
+
    MatchProduct   "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"
+
    MatchDevicePath   "/dev/input/event*"
+
    Option   "EmulateWheel" "true"
+
    Option   "EmulateWheelButton"         "2"
+
    Option   "Emulate3Buttons"         "false"
+
    Option   "XAxisMapping" "6 7"
+
    Option   "YAxisMapping" "4 5"
+
EndSection
+
</nowiki>}}
+
 
+
=====Example: Tap-to-click=====
+
Tap-to-click can be enabled in the mouse configuration dialog (in the touchpad tab) but if you need tapping enabled at gdm already, the following snippet does it for you:
+
{{bc|
+
Section "InputClass"
+
    Identifier            "tap-by-default"
+
    MatchIsTouchpad      "on"
+
    Option                "TapButton1" "1"
+
EndSection
+
}}
+
 
+
=====Example: Keyboard layout and model on Acer 5920G laptop=====
+
 
+
Keyboard model and layout may be set in the file {{ic|/etc/X11/xorg.conf.d/keyboard.conf}} or any other .conf file in the same directory.
+
* {{ic|MatchIsKeyboard "yes"}}: set the input device to a keyboard
+
* {{ic|Option "XkbModel" "acer_laptop"}}: set the keyboard model to an Acer laptop keyboard.  You may replace {{ic|acer_laptop}} with your actual keyboard layout.
+
* {{ic|Option "XkbLayout" "be"}}: set the keyboard layout to belgian.  You may replace {{ic|be}} with whatever layout you have.
+
* {{ic|Option "XkbVariant" "sundeadkeys"}}: set the layout variant to Sun dead keys. You may omit the {{ic|XkbVariant}} option if you stick with the default variant.
+
 
+
Note that a list of keyboard layouts and models can be found in {{ic|/usr/share/X11/xkb/rules/base.lst}}
+
 
+
{{bc|
+
Section "InputClass"
+
    Identifier            "Keyboard Defaults"
+
    MatchIsKeyboard        "yes"
+
    Option                "XkbModel" "acer_laptop"
+
    Option                "XkbLayout" "be"
+
    Option                "XkbVariant" "sundeadkeys"
+
EndSection
+
}}
+
 
+
=====Example: Third button emulation (for all attached mice)=====
+
Third button emulation allows you to use the 1 and 2 buttons (left and right click) together to produce a button 3 event (middle-click), which is really useful for copy and paste in X.
+
 
+
We will modify the mouse input catchall in {{ic|/etc/X11/xorg.conf.d/10-evdev.conf}}
+
{{bc|
+
Section "InputClass"
+
        Identifier "evdev pointer catchall"
+
        MatchIsPointer "on"
+
        MatchDevicePath "/dev/input/event*"
+
        Driver "evdev"
+
        Option "Emulate3Buttons"    "True"
+
        Option "Emulate3Timeout"    "25"
+
EndSection
+
}}
+
 
+
Here you see the {{ic|Option "Emulate3Buttons"    "True"}} and {{ic|Option "Emulate3Timeout"    "25"}} options that specify that 3 buttons should be emulated and the delay to recognize both buttons down as a middle click is 25ms.
+
 
+
==Graphics==
+
===Driver installation===
+
The default graphics driver is vesa ({{Pkg|xf86-video-vesa}}), which handles a large number of chipsets but does not include any 2D or 3D acceleration.  To enable graphics acceleration, you will need to install and use the driver specific to your graphics card.
+
 
+
First, identify your card:
+
$ lspci | grep VGA
+
 
+
Then, install an appropriate driver. You can search for these packages with the following command:
+
$ pacman -Ss xf86-video
+
 
+
Common open source drivers:
+
*NVIDIA: {{Pkg|xf86-video-nouveau}} (see [[Nouveau]])
+
*Intel: {{Pkg|xf86-video-intel}} (see [[Intel]])
+
*ATI: {{Pkg|xf86-video-ati}} (see [[ATI]])
+
 
+
Common proprietary drivers:
+
*NVIDIA: {{Pkg|nvidia}} (see [[NVIDIA]])
+
*ATI: {{AUR|catalyst}} (see [[ATI Catalyst]])
+
 
+
Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games, dual-screen setups, and TV-out.
+
 
+
===Monitor settings===
+
====Getting started====
+
{{Note|This step is OPTIONAL and should not be done unless you know what you are doing.<br>
+
This step is '''NOT OPTIONAL''' if using dual monitors and the nouveau driver. See [[Nouveau#Configuration]].}}
+
  
 
First, create a new config file, such as {{ic|/etc/X11/xorg.conf.d/10-monitor.conf}}.
 
First, create a new config file, such as {{ic|/etc/X11/xorg.conf.d/10-monitor.conf}}.
  
Insert the following code into the config file mentioned above:
+
{{hc|/etc/X11/xorg.conf.d/10-monitor.conf|<nowiki>
 
+
{{bc|<nowiki>
+
 
Section "Monitor"
 
Section "Monitor"
 
     Identifier            "Monitor0"
 
     Identifier            "Monitor0"
Line 394: Line 206:
 
     Device                "Device0"
 
     Device                "Device0"
 
     Monitor                "Monitor0"
 
     Monitor                "Monitor0"
     DefaultDepth           16 #Choose the depth (16||24)
+
     DefaultDepth           16 #Choose the depth (16||24)
 
     SubSection            "Display"
 
     SubSection            "Display"
         Depth               16
+
         Depth             16
 
         Modes              "1024x768_75.00" #Choose the resolution
 
         Modes              "1024x768_75.00" #Choose the resolution
 
     EndSubSection
 
     EndSubSection
Line 402: Line 214:
 
</nowiki>}}
 
</nowiki>}}
  
====Multiple monitors/Dual screen====
+
{{Note|By default, Xorg needs to be able to detect a monitor and will not start otherwise. A workaround is to create a configuration file such as the example above and thus avoid auto-configuring. A common case where this is necessary is a headless system, which boots without a monitor and starts Xorg automatically, either from a [[Automatic login to virtual console|virtual console]] at [[Start X at login|login]], or from a [[display manager]].}}
=====NVIDIA=====
+
 
Please see: [[NVIDIA#Multiple monitors]].
+
=== Multiple monitors ===
 +
 
 +
See main article [[Multihead]] for general information.
 +
 
 +
See also GPU-specific instructions:
 +
* [[NVIDIA#Multiple monitors]]
 +
* [[Nouveau#Dual Head]]
 +
* [[AMD Catalyst#Double Screen (Dual Head / Dual Screen / Xinerama)]]
 +
* [[ATI#Multihead setup]]
 +
 
 +
==== More than one graphics card ====
  
=====More than one graphics card=====
 
 
You must define the correct driver to use and put the bus ID of your graphic cards.
 
You must define the correct driver to use and put the bus ID of your graphic cards.
 +
 
{{bc|
 
{{bc|
 
Section "Device"
 
Section "Device"
Line 423: Line 245:
  
 
To get your bus ID:
 
To get your bus ID:
$ lspci | grep VGA
+
 
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
+
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<nowiki>
 +
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
 +
</nowiki>}}
  
 
The bus ID here is 1:0:0.
 
The bus ID here is 1:0:0.
  
=====Script to toggle internal/external display for laptops=====
+
=== Display size and DPI ===
Run the following script after connecting to external displays with your computer to change the display used by Xorg. It checks if a display is connected to the port specified in {{ic|EXT}} before changing displays.
+
  
To find out the display names to be specified in {{ic|EXT}} run:
+
{{Accuracy|1=Xorg always sets dpi to 96. See [https://bugs.freedesktop.org/show_bug.cgi?id=23705 this], [https://bugs.freedesktop.org/show_bug.cgi?id=41115 this] and finally [http://pastebin.com/vtzyBK6e this].}}
# xrandr -q
+
The internal display should be connected when running the script, which is always true for a laptop. To use this script the package {{Pkg|xorg-xrandr}} needs to be installed.
+
{{bc|<nowiki>
+
#!/bin/bash
+
 
+
IN="LVDS1"
+
EXT="VGA1"
+
 
+
if (xrandr | grep "$EXT" | grep "+")
+
    then
+
    xrandr --output $EXT --off --output $IN --auto
+
    else
+
        if (xrandr | grep "$EXT" | grep " connected")
+
            then
+
            xrandr --output $IN --off --output $EXT --auto
+
        fi
+
fi
+
</nowiki>}}
+
  
==== Display Size and DPI ====
 
 
The DPI of the X server is determined in the following manner:
 
The DPI of the X server is determined in the following manner:
 
# The -dpi command line option has highest priority.
 
# The -dpi command line option has highest priority.
Line 458: Line 262:
 
# If DDC does not specify a size, 75 DPI is used by default.
 
# If DDC does not specify a size, 75 DPI is used by default.
  
In order to get correct dots per inch (DPI) set, the display size must be recognized or set. Having the correct DPI is especially necessary where fine detail is required (like font rendering). Previously, manufacturers tried to create a standard for 96 DPI (a 10.3" diagonal monitor would be 800x600, a 13.2" monitor 1024x768). These days, screen DPIs vary and may not be equal horizontally and vertically. For example, a 19" widescreen LCD at 1440x900 may have a DPI of 89x87. To be able to set the DPI, the Xorg server attempts to auto-detect your monitor's physical screen size through the graphic card with [http://en.wikipedia.org/wiki/Display_Data_Channel DDC].  When the Xorg server knows the physical screen size, it will be able to set the correct DPI depending on resolution size.
+
In order to get correct dots per inch (DPI) set, the display size must be recognized or set. Having the correct DPI is especially necessary where fine detail is required (like font rendering). Previously, manufacturers tried to create a standard for 96 DPI (a 10.3" diagonal monitor would be 800x600, a 13.2" monitor 1024x768). These days, screen DPIs vary and may not be equal horizontally and vertically. For example, a 19" widescreen LCD at 1440x900 may have a DPI of 89x87. To be able to set the DPI, the Xorg server attempts to auto-detect your monitor's physical screen size through the graphic card with [[wikipedia:Display_Data_Channel|DDC]].  <s>When the Xorg server knows the physical screen size, it will be able to set the correct DPI depending on resolution size.</s>
  
 
To see if your display size and DPI are detected/calculated correctly:
 
To see if your display size and DPI are detected/calculated correctly:
Line 486: Line 290:
 
If you do not have specifications for physical screen width and height (most specifications these days only list by diagonal size), you can use the monitor's native resolution (or aspect ratio) and diagonal length to calculate the horizontal and vertical physical dimensions.  Using the Pythagorean theorem on a 13.3" diagonal length screen with a 1280x800 native resolution (or 16:10 aspect ratio):
 
If you do not have specifications for physical screen width and height (most specifications these days only list by diagonal size), you can use the monitor's native resolution (or aspect ratio) and diagonal length to calculate the horizontal and vertical physical dimensions.  Using the Pythagorean theorem on a 13.3" diagonal length screen with a 1280x800 native resolution (or 16:10 aspect ratio):
  
  echo 'scale=5;sqrt(1280^2+800^2)' | bc  # 1509.43698
+
  $ echo 'scale=5;sqrt(1280^2+800^2)' | bc  # 1509.43698
  
 
This will give the pixel diagonal length and with this value you can discover the physical horizontal and vertical lengths (and convert them to millimeters):
 
This will give the pixel diagonal length and with this value you can discover the physical horizontal and vertical lengths (and convert them to millimeters):
  
{{bc|<nowiki>
+
$ echo 'scale=5;(13.3/1509)*1280*25.4' | bc  # 286.43072
echo 'scale=5;(13.3/1509)*1280*25.4' | bc  # 286.43072
+
$ echo 'scale=5;(13.3/1509)*800*25.4'  | bc  # 179.01920
echo 'scale=5;(13.3/1509)*800*25.4'  | bc  # 179.01920
+
</nowiki>}}
+
  
 
{{Note|This calculation works for monitors with square pixels; however, there is the seldom monitor that may compress aspect ratio (e.g 16:10 aspect resolution to a 16:9 monitor). If this is the case, you should measure your screen size manually.}}
 
{{Note|This calculation works for monitors with square pixels; however, there is the seldom monitor that may compress aspect ratio (e.g 16:10 aspect resolution to a 16:9 monitor). If this is the case, you should measure your screen size manually.}}
  
===== Setting DPI manually =====
+
==== Setting DPI manually ====
 +
 
 +
{{Note|While you can set any dpi you like and applications using Qt and GTK will scale accordingly, it's recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUI that use bitmaps. Reducing it below 96 dpi may not reduce size of graphical elements of GUI as typically the lowest dpi the icons are made for is 96.}}
 +
 
 +
For RandR compliant drivers (for example the open source ATI driver), you can set it by:
 +
 
 +
$ xrandr --dpi 144
 +
 
 +
{{Note|Applications that comply with the setting will not change immediately. You have to start them anew.}}
 +
 
 +
See [[Execute commands after X start]] to make it permanent.
 +
 
 +
===== Proprietary NVIDIA driver =====
 +
 
 
DPI can be set manually if you only plan to use one resolution ([http://pxcalc.com/ DPI calculator]):
 
DPI can be set manually if you only plan to use one resolution ([http://pxcalc.com/ DPI calculator]):
  
Line 507: Line 322:
 
}}
 
}}
  
If you use an NVIDIA card, you can manually set the DPI adding the options bellow on {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}} (inside '''Device''' section):
+
You can manually set the DPI adding the options below on {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}} (inside '''Device''' section):
  
 
  Option              "UseEdidDpi" "False"
 
  Option              "UseEdidDpi" "False"
 
  Option              "DPI" "96 x 96"
 
  Option              "DPI" "96 x 96"
  
For RandR compliant drivers, you can set it by:
+
=== DPMS ===
  
xrandr --dpi 96
+
[[DPMS]] (Display Power Management Signaling) is a technology that allows power saving behaviour of monitors when the computer is not in use. This will allow you to have your monitors automatically go into standby after a predefined period of time.
  
See [[Execute commands after X start]] to make it permanent.
+
== Composite ==
  
Note: while you can set any dpi you like and applications using Qt and GTK will scale accordingly, it's recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUI that use bitmaps. Reducing it below 96 dpi may not reduce size of graphical elements of GUI as typically the lowest dpi the icons are made for is 96.
+
The Composite extension for X causes an entire sub-tree of the window hierarchy to be rendered to an off-screen buffer. Applications can then take the contents of that buffer and do whatever they like. The off-screen buffer can be automatically merged into the parent window or merged by external programs, called compositing managers. See the following article for more information: [[Wikipedia:Compositing window manager|compositing window manager]]
  
====DPMS====
+
Some window managers (e.g. [[Compiz]], [[Enlightenment]], KWin, Marco, Metacity, Muffin, Mutter, [[Xfwm]]) do compositing on their own. For other window managers, a standalone composite manager can be used.
DPMS (Display Power Management Signaling) is a technology that allows power saving behaviour of monitors when the computer is not in use. This will allow you to have your monitors automatically go into standby after a predefined period of time. See: [[DPMS]]
+
  
== Composite ==
+
=== List of composite managers ===
The Composite extension for X causes an entire sub-tree of the window hierarchy to be rendered to an off-screen buffer. Applications can then take the contents of that buffer and do whatever they like. The off-screen buffer can be automatically merged into the parent window or merged by external programs, called compositing managers. See the following page for more info.
+
  
*[[Compiz]] -- The original composite/window manager from Novell
+
* {{App|[[Cairo Compmgr|Cairo Composite Manager]]|Cairo based composite manager|http://cairo-compmgr.tuxfamily.org/|{{AUR|cairo-compmgr-git}}}}
*[[Xcompmgr]] -- A simple composite manager capable of drop shadows and primitive transparency
+
* {{App|[[Compton]]|Compositor (a fork of xcompmgr-dana)|https://github.com/chjj/compton|{{Pkg|compton}}}}
*[[Compton]] -- A fork of [[xcompmgr]] with feature improves and bug fix
+
* {{App|[[Xcompmgr]]|Composite window-effects manager|http://cgit.freedesktop.org/xorg/app/xcompmgr/|{{Pkg|xcompmgr}}}}
*[[Cairo Compmgr|Cairo Composite Manager]] -- A versatile and extensible composite manager which uses cairo for rendering.
+
* {{App|Unagi|Modular compositing manager which aims written in C and based on XCB|http://projects.mini-dweeb.org/projects/unagi|{{AUR|unagi}}}}
*[[Wikipedia:Compositing window manager]]
+
  
==Sample configurations==
+
== Tips and tricks ==
Anyone who has an {{ic|xorg.conf}} file written up that works, go ahead and post a link to it here for others to look at. Please do not in-line the entire configuration file; upload it somewhere else and link to it.
+
  
'''Please post input hotplugging configurations only, otherwise note that your config is not using input hotplugging.''' (Xorg 1.8 = udev)
+
=== X startup tweaking (startx) ===
  
=== Sample 1: {{ic|xorg.conf}} & {{ic|/etc/X11/xorg.conf.d/10-evdev.conf}} ===
+
{{Accuracy|{{ic|/usr/bin/startx}} should not be modified, ''startx'' recognises the options as command line arguments}}
This is a sample configuration file using {{ic|/etc/X11/xorg.conf.d/10-evdev.conf}} for the keyboard layouts:
+
  
{{Note|The "InputDevice" sections are commented out, because {{ic|/etc/X11/xorg.conf.d/10-evdev.conf}} is taking care of them.}}
 
{{ic|xorg.conf}}: http://pastebin.com/raw.php?i=EuSKahkn
 
{{ic|/etc/X11/xorg.conf.d/10-evdev.conf}}: http://pastebin.com/raw.php?i=4mPY35Mw
 
{{ic|/etc/X11/xorg.conf.d/10-monitor.conf}} (VMware): http://pastebin.com/raw.php?i=fJv8EXGb
 
{{ic|/etc/X11/xorg.conf.d/10-monitor.conf}} (KVM): http://pastebin.com/raw.php?i=NRz7v0Kn
 
 
==Tips and tricks==
 
===X startup ({{ic|/usr/bin/startx}}) tweaking===
 
 
For X's option reference see:
 
For X's option reference see:
 
  $ man Xserver
 
  $ man Xserver
Line 556: Line 358:
 
  -deferglyphs 16
 
  -deferglyphs 16
  
{{Note|1=If you start X with kdm, the startx script does not seem to be executed. X options must be appended to the variable {{ic|"ServerArgsLocal"}} or {{ic|"ServerCmd"}} in the {{ic|/usr/share/config/kdm/kdmrc}} file. By default kdm options are:
+
{{Note|If you start X with kdm, the startx script does not seem to be executed. X options must be appended to the variable {{ic|ServerArgsLocal}} in the {{ic|/usr/share/config/kdm/kdmrc}} file.}}
{{bc|1=ServerArgsLocal=-nolisten tcp
+
 
ServerCmd=/usr/bin/X}}
+
=== Nested X session ===
}}
+
 
 +
{{Expansion|mention [[Awesome#Using_Xephyr|xephyr]]}}
  
===Nested X session===
 
 
To run a nested session of another desktop environment:
 
To run a nested session of another desktop environment:
 
  $ /usr/bin/Xnest :1 -geometry 1024x768+0+0 -ac -name Windowmaker & wmaker -display :1
 
  $ /usr/bin/Xnest :1 -geometry 1024x768+0+0 -ac -name Windowmaker & wmaker -display :1
Line 569: Line 371:
 
This needs the package {{Pkg|xorg-server-xnest}} to be installed.
 
This needs the package {{Pkg|xorg-server-xnest}} to be installed.
  
===Starting GUI Programs Remotely===
+
=== Starting GUI programs remotely ===
To start up a program that uses X when logged in remotely (such as through ssh), you need to type this in from the remote login Bash shell:
+
  
export DISPLAY=:0
+
See main article: [[SSH#X11 forwarding]].
  
Then invoke the program the way you would locally from the shell.
+
=== On-demand disabling and enabling of input sources ===
  
Hint: Add that line to ~/.bashrc to have it happen automatically every time you log in.
+
With the help of ''xinput'' you can temporarily disable or enable input sources. This might be useful, for example, on systems that have more than one mouse, such as the ThinkPads and you would rather use just one to avoid unwanted mouse clicks.
  
===On-Demand Disabling and Enabling of Input Sources===
+
[[Install]] the {{Pkg|xorg-xinput}} package from the [[official repositories]].
With the help of {{ic|xinput}} you can temporarily disable or enable input sources. This might be useful, for example, on systems that have more than one mouse, such as the ThinkPads and you would rather use just one to avoid unwanted mouse clicks. Let's see how to accomplish this.
+
  
Install {{ic|xinput}} from the {{Pkg|xorg-xinput}} package: {{bc|# pacman -S xorg-xinput}}
+
Find the name or ID of the device you want to disable:
  
Find the ID of the device you want to disable: {{bc|xinput}}
+
$ xinput
  
 
For example in a Lenovo ThinkPad T500, the output looks like this:
 
For example in a Lenovo ThinkPad T500, the output looks like this:
{{hc|$ xinput|<nowiki>⎡ Virtual core pointer                    id=2 [master pointer  (3)]
 
⎜  ↳ Virtual core XTEST pointer              id=4 [slave  pointer  (2)]
 
⎜  ↳ TPPS/2 IBM TrackPoint                  id=11 [slave  pointer  (2)]
 
⎜  ↳ SynPS/2 Synaptics TouchPad              id=10 [slave  pointer  (2)]
 
⎣ Virtual core keyboard                  id=3 [master keyboard (2)]
 
    ↳ Virtual core XTEST keyboard            id=5 [slave  keyboard (3)]
 
    ↳ Power Button                            id=6 [slave  keyboard (3)]
 
    ↳ Video Bus                              id=7 [slave  keyboard (3)]
 
    ↳ Sleep Button                            id=8 [slave  keyboard (3)]
 
    ↳ AT Translated Set 2 keyboard            id=9 [slave  keyboard (3)]
 
    ↳ ThinkPad Extra Buttons                  id=12 [slave  keyboard (3)]</nowiki>
 
}}
 
  
Disable the device with {{ic|xinput --disable DEVICE}}, where DEVICE is the device ID you want to disable. In this example we'll disable the Synaptics Touchpad, with the ID 10:
+
{{hc|$ xinput|<nowiki>
{{bc|xinput --disable 10}}
+
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
 +
⎜  ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
 +
⎜  ↳ TPPS/2 IBM TrackPoint                    id=11  [slave  pointer  (2)]
 +
⎜  ↳ SynPS/2 Synaptics TouchPad                id=10  [slave  pointer  (2)]
 +
⎣ Virtual core keyboard                        id=3    [master keyboard (2)]
 +
    ↳ Virtual core XTEST keyboard              id=5    [slave  keyboard (3)]
 +
    ↳ Power Button                              id=6    [slave  keyboard (3)]
 +
    ↳ Video Bus                                id=7    [slave  keyboard (3)]
 +
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
 +
    ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
 +
    ↳ ThinkPad Extra Buttons                    id=12  [slave  keyboard (3)]
 +
</nowiki>}}
 +
 
 +
Disable the device with {{ic|xinput --disable ''device''}}, where ''device'' is the device ID or name of the device you want to disable. In this example we will disable the Synaptics Touchpad, with the ID 10:
 +
 
 +
$ xinput --disable 10
  
 
To re-enable the device, just issue the opposite command:
 
To re-enable the device, just issue the opposite command:
{{bc|xinput --enable DEVICE}}
 
  
==Troubleshooting==
+
$ xinput --enable 10
===Common problems===
+
If Xorg will not start, the screen is completely black, the keyboard and mouse are not working, etc., first take these simple steps:
+
*Check the log file: {{ic|cat /var/log/Xorg.0.log}}
+
*Install input driver (keyboard, mouse, joystick, tablet, etc...):
+
*Finally, search for common problems in [[ATI]], [[Intel]] and [[NVIDIA]] articles.
+
  
===Ctrl+Alt+Backspace does not work===
+
Alternatively using the device name, the command to disable the touchpad would be:
There are two ways of restoring {{Keypress|Ctrl+Alt+Backspace}}; with and without input-hotplugging. Using hot-plugging is recommended.
+
  
====With input hot-plugging====
+
$ xinput --disable "SynPS/2 Synaptics TouchPad"
=====System-wide=====
+
Within {{ic|/etc/X11/xorg.conf.d/10-evdev.conf}}, simply add the following:
+
{{bc|
+
Section "InputClass"                                                           
+
        Identifier "Keyboard Defaults"                                         
+
        MatchIsKeyboard "yes"                                                 
+
        Option "XkbOptions" "terminate:ctrl_alt_bksp"                          
+
EndSection
+
}}
+
  
{{Note|Using Gnome, an alternative would be to install the gnome-tweak-tool from extra. Within the Gnome Tweak Tool: Typing > Terminate and select the option {{keypress|Ctrl+Alt+Backspace}} from the dropdown menu.
+
=== Killing application with hotkey ===
This reactivates the keyboard shortcut for killing the X server in Gnome.}}
+
Run script on hotkey:
  
{{Note|On KDE, this system-wide setting has no effect. To restore, go to Kickoff > Computer > System Settings which will open up the System Settings window. Click on 'Input Devices'. In this new window click the Keyboard tab and then click on the advanced tab. In this new window, click the box for 'Configure keyboard options.' Expand the entry for 'Key sequence to kill the X server' and ensure {{keypress|Ctrl+Alt+Backspace}} is checked. Click Apply and close the System Settings window. You now have your {{keypress|Ctrl+Alt+Backspace}} back in KDE.}}
+
#!/bin/bash
 +
windowFocus=$(xdotool getwindowfocus);
 +
pid=$(xprop -id $windowFocus | grep PID);
 +
kill -9 $pid
 +
 
 +
Deps: {{Pkg|xorg-xprop}}, {{Pkg|xdotool}}
 +
 
 +
== Troubleshooting ==
 +
 
 +
=== General ===
 +
 
 +
If a problem occurs, view the log stored in either {{ic|/var/log/}} or, for the rootless X default since v1.16, in {{ic|~/.local/share/xorg/}}. [[GDM]] users should check the [[systemd]] journal. [https://bbs.archlinux.org/viewtopic.php?id=184639]
 +
 
 +
The logfiles are of the form {{ic|Xorg.n.log}} with {{ic|n}} being the display number. For a single user machine with default configuration the applicable log is frequently {{ic|Xorg.0.log}}, but otherwise it may vary. To make sure to pick the right file it may help to look at the timestamp of the X server session start and from which console it was started. For example:
 +
 
 +
{{hc|1=$ grep -e Log -e tty Xorg.0.log|2=[    40.623] (==) Log file: "/home/archuser/.local/share/xorg/Xorg.0.log", Time: Thu Aug 28 12:36:44 2014
 +
[    40.704] (--) controlling tty is VT number 1, auto-enabling KeepTty}}
 +
 
 +
* In the logfile then be on the lookout for any lines beginning with {{ic|(EE)}}, which represent errors, and also {{ic|(WW)}}, which are warnings that could indicate other issues.
 +
 
 +
* If there is an ''empty'' {{ic|.xinitrc}} file in your {{ic|$HOME}}, either delete or edit it in order for X to start properly. If you do not do this X will show a blank screen with what appears to be no errors in your {{ic|Xorg.0.log}}. Simply deleting it will get it running with a default X environment.
 +
* If the screen goes black, you may still attempt to switch to a different virtual console (e.g. {{ic|Ctrl+Alt+F2}}), and blindly log in as root. You can do this by typing {{ic|root}} (press {{ic|Enter}} after typing it) and entering the root password (again, press {{ic|Enter}} after typing it).
 +
 
 +
: You may also attempt to kill the X server with:
 +
: {{bc|# pkill X}}
 +
: If this does not work, reboot blindly with:
 +
: {{bc|# reboot}}
 +
 
 +
*Check specific pages in [[:Category:Input devices]] if you have issues with keyboard, mouse, touchpad etc.
 +
*Search for common problems in [[ATI]], [[Intel]] and [[NVIDIA]] articles.
 +
 
 +
=== Black screen, No protocol specified.., Resource temporarily unavailable for all or some users ===
 +
 
 +
X creates configuration and temporary files in current user's home directory. Make sure there is free disk space available on the partition your home directory resides in. Unfortunately, X server does not provide any more obvious information about lack of disk space in this case.
  
=====User-specific=====
+
=== CTRL right key does not work with oss keymap ===
Another way is to put this line in [[xinitrc]]:
+
setxkbmap -option terminate:ctrl_alt_bksp
+
  
{{Note|This setting has no effect on Gnome 3.}}
+
{{Accuracy|The file will be overwritten on {{Pkg|xkeyboard-config}} update; for such simple task should be used [[Xmodmap]].}}
  
====Without input hot-plugging====
+
Edit as root {{ic|/usr/share/X11/xkb/symbols/fr}}, and change the line:
New Xorg disables zapping with {{keypress|Ctrl+Alt+Backspace}} by default. You can enable it by adding the following line to {{ic|/etc/X11/xorg.conf}},
+
 
  Option                    "XkbOptions" "terminate:ctrl_alt_bksp"
+
  include "level5(rctrl_switch)"
to {{ic|InputDevice}} section for keyboard.
+
  
===CTRL right key does not work with oss keymap===
 
Edit as root {{ic|/usr/share/X11/xkb/symbols/fr}}, and change the line :
 
{{bc|include "level5(rctrl_switch)"}}
 
 
to
 
to
{{bc|// include "level5(rctrl_switch)"}}
 
Then restart X or reboot.
 
  
===Apple keyboard issues===
+
// include "level5(rctrl_switch)"
:''See: [[Apple Keyboard]]''
+
  
===Touchpad tap-click issues===
+
Then restart X, reboot or run
:''See: [[Synaptics]]''
+
  
===Extra mouse buttons not recognized===
+
setxkbmap fr oss
:''See: [[Get All Mouse Buttons Working]]''
+
  
===X clients started with "su" fail===
+
=== DRI with Matrox cards stops working ===
If you are getting "Client is not authorized to connect to server", try adding the line:
+
session        optional        pam_xauth.so
+
to {{ic|/etc/pam.d/su}}. {{ic|pam_xauth}} will then properly set environment variables and handle {{ic|xauth}} keys.
+
  
===Program requests "font '(null)'"===
+
If you use a Matrox card and DRI stops working after upgrading to Xorg, try adding the line:
*Error message: "''unable to load font `(null)'.''"
+
 
Some programs only work with bitmap fonts. Two major packages with bitmap fonts are available, {{Pkg|xorg-fonts-75dpi}} and {{Pkg|xorg-fonts-100dpi}}. You do not need both; one should be enough. To find out which one would be better in your case, try this:
+
Option "OldDmaInit" "On"
$ xdpyinfo | grep resolution
+
 
and use what is closer to you (75 or 100 instead of XX)
+
to the Device section that references the video card in {{ic|xorg.conf}}.
# pacman -S xorg-fonts-XXdpi
+
 
 +
=== Frame-buffer mode problems ===
  
===Frame-buffer mode problems===
 
 
If X fails to start with the following log messages,
 
If X fails to start with the following log messages,
 +
 
{{bc|<nowiki>
 
{{bc|<nowiki>
 
(WW) Falling back to old probe method for fbdev
 
(WW) Falling back to old probe method for fbdev
Line 685: Line 492:
 
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices
 
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices
 
</nowiki>}}
 
</nowiki>}}
uninstall fbdev:
 
# pacman -R xf86-video-fbdev
 
  
===DRI with Matrox cards stops working===
+
[[Uninstall]] the {{pkg|xf86-video-fbdev}} package.
If you use a Matrox card and DRI stops working after upgrading to Xorg, try adding the line:
+
 
  Option "OldDmaInit" "On"
+
=== Launching multiple X sessions with proprietary NVIDIA on Xorg 1.16 ===
to the Device section that references the video card in {{ic|xorg.conf}}.
+
 
 +
When attempting to launch X sessions in multiple ttys on Xorg 1.16, you may be rejected with a log indicating that no drivers were found. I found that a workaround for this was to specifically tell X that we'd like to use the 'nvidia' driver.
 +
 
 +
{{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}}
 +
  Section "Device"
 +
    Identifier "Device0"
 +
    Driver    "nvidia"
 +
    VendorName "NVIDIA Corporation"
 +
    Option     "NoLogo" "True"
 +
EndSection
 +
 
 +
=== Program requests "font '(null)'" ===
 +
 
 +
* Error message: "''unable to load font `(null)'.''"
 +
Some programs only work with bitmap fonts. Two major packages with bitmap fonts are available, {{Pkg|xorg-fonts-75dpi}} and {{Pkg|xorg-fonts-100dpi}}. You do not need both; one should be enough. To find out which one would be better in your case, try this:
 +
 
 +
$ xdpyinfo | grep resolution
 +
 
 +
and use what is closer to the shown value.
 +
 
 +
=== Recovery: disabling Xorg before GUI login ===
  
===Recovery: disabling Xorg before GUI login===
 
 
If Xorg is set to boot up automatically and for some reason you need to prevent it from starting up before the login/display manager appears (if the system is wrongly configured and Xorg does not recognize your mouse or keyboard input, for instance), you can accomplish this task with two methods.
 
If Xorg is set to boot up automatically and for some reason you need to prevent it from starting up before the login/display manager appears (if the system is wrongly configured and Xorg does not recognize your mouse or keyboard input, for instance), you can accomplish this task with two methods.
  
*From the GRUB menu, you can specify the runlevel in the kernel line by adding a number to the end of the kernel line specifying the run level you want. The following example sets the run level to 3:
+
* Change default target to rescue.target. See [[systemd#Change default target to boot into]].
  kernel /boot/vmlinuz-linux root=/dev/disk/by-uuid/..ro 3
+
* If you have not only a faulty system that makes Xorg unusable, but you have also set the GRUB menu wait time to zero, or cannot otherwise use GRUB to prevent Xorg from booting, you can use the Arch Linux live CD. Follow the [[Installation_guide#Mount_the_partitions|installation guide]] about how to mount and chroot into the installed Arch Linux. Alternatively try to switch into another [[Getty|tty]] with {{ic|Ctrl+Alt}} + function key (usually from {{ic|F1}} to {{ic|F7}} depending on which is not used by X), login as root and follow steps below.
  
*If you have not only a faulty system that makes Xorg unusable, but you have also set the GRUB menu wait time to zero, or cannot otherwise use GRUB to prevent Xorg from booting, you can use the Arch Linux live CD. Boot up the live CD and log in as root. You need a mount point, such as {{ic|/mnt}}, and you need to know the name of the partition you want to mount.
+
Depending on setup, you will need to do one or more of these steps:
  
:You can use the command,
+
* [[Disable]] the [[display manager]].
  # fdisk -l
+
* Disable the [[start X at login|automatic start of the X]].
:to see your partitions. Usually, the one you want will be resembling {{ic|/dev/sda1}}. Then, to mount this to {{ic|/mnt}}, use
+
* Rename the {{ic|~/.xinitrc}} or comment out the {{ic|exec}} line in it.
  # mount /dev/sda1 /mnt
+
  
:Then your filesystem will show up under {{ic|/mnt}}. From here you can delete the {{ic|gdm}} daemon to prevent Xorg from booting up normally or make any other necessary changes to the configuration.
+
=== X clients started with "su" fail ===
 +
 
 +
If you are getting "Client is not authorized to connect to server", try adding the line:
 +
 
 +
session        optional        pam_xauth.so
 +
 
 +
to {{ic|/etc/pam.d/su}}. {{ic|pam_xauth}} will then properly set environment variables and handle {{ic|xauth}} keys.
 +
 
 +
=== X failed to start: Keyboard initialization failed ===
  
===X failed to start : Keyboard initialization failed===
 
 
If your hard disk is full, startx will fail. {{ic|/var/log/Xorg.0.log}} will end with:
 
If your hard disk is full, startx will fail. {{ic|/var/log/Xorg.0.log}} will end with:
(EE) Error compiling keymap (server-0)
+
 
(EE) XKB: Couldn't compile keymap
+
{{bc|<nowiki>
(EE) XKB: Failed to load keymap. Loading default keymap instead.
+
(EE) Error compiling keymap (server-0)
(EE) Error compiling keymap (server-0)
+
(EE) XKB: Could not compile keymap
(EE) XKB: Couldn't compile keymap
+
(EE) XKB: Failed to load keymap. Loading default keymap instead.
XKB: Failed to compile keymap
+
(EE) Error compiling keymap (server-0)
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
+
(EE) XKB: Could not compile keymap
Fatal server error:
+
XKB: Failed to compile keymap
Failed to activate core devices.
+
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
Please consult the The X.Org Foundation support at http://wiki.x.org
+
Fatal server error:
for help.
+
Failed to activate core devices.
Please also check the log file at "/var/log/Xorg.0.log" for additional information.
+
Please consult the The X.Org Foundation support at http://wiki.x.org
  (II) AIGLX: Suspending AIGLX clients for VT switch
+
for help.
 +
Please also check the log file at "/var/log/Xorg.0.log" for additional information.
 +
(II) AIGLX: Suspending AIGLX clients for VT switch
 +
</nowiki>}}
  
 
Make some free space on your root partition and X will start.
 
Make some free space on your root partition and X will start.
  
===black screen, No protocol specified.., Resource temporarily unavailable for all or some users===
+
=== Rootless Xorg (v1.16) ===
X creates configuration and temporary files in current user's home directory. Make sure there is free disk space available on the partition your home directory resides in. Unfortunately, X server does not provide any more obvious information about lack of disk space in this case.
+
 
 +
As of version 1.16 [https://www.archlinux.org/news/xorg-server-116-is-now-available/], Xorg may run with standard user privileges with the help of {{ic|logind}}. The requirements for this are:
 +
 
 +
* [[systemd]]; version >=216 for multiple instances
 +
* Starting X via [[xinit]]; display managers are not supported
 +
* [[Kernel mode setting]]; implementations in proprietary display drivers fail [http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/xorg-wrapper.c#n222 auto-detection] and require manually setting {{ic|1=needs_root_rights = no}} in {{ic|/etc/X11/Xwrapper.config}}.
 +
 
 +
If you do not fit these requirements, re-enable root rights in {{ic|/etc/X11/Xwrapper.config}}:
 +
 
 +
needs_root_rights = ''yes''
 +
 
 +
See also [http://manned.org/Xorg.wrap.1 Xorg.wrap(1)] and [[Systemd/User#Xorg as a systemd user service]].
 +
 
 +
==== Broken redirection ====
 +
 
 +
While user Xorg logs are stored in {{ic|~/.local/share/xorg/Xorg.log}}, they do not include the output from the X session. To re-enable redirection, start X with the {{ic|-keeptty}} flag:
 +
 
 +
exec startx -- -keeptty -nolisten tcp > ~/.xorg.log 2>&1
 +
 
 +
Or copy {{ic|/etc/X11/xinit/xserverrc}} to {{ic|~/.xserverrc}}, and append {{ic|-keeptty}}. See [https://bbs.archlinux.org/viewtopic.php?pid=1446402#p1446402].
 +
 
 +
=== Why do I get a green screen whenever I try to watch a video?===
 +
 
 +
Your color depth is set wrong. It may need to be 24 instead of 16, for example.
 +
 
 +
=== SocketCreateListener error ===
 +
 
 +
If X terminates with error message "SocketCreateListener() failed", you may need to delete socket files in {{ic|/tmp/.X11-unix}}. This may happen if you have previously run Xorg as root (e.g. to generate an {{ic|xorg.conf}}).

Latest revision as of 11:01, 7 August 2016

From http://www.x.org/wiki/:

The X.Org project provides an open source implementation of the X Window System. The development work is being done in conjunction with the freedesktop.org community. The X.Org Foundation is the educational non-profit corporation whose Board serves this effort, and whose Members lead this work.

Xorg is the most popular display server among Linux users. Its ubiquity has led to making it an ever-present requisite for GUI applications, resulting in massive adoption from most distributions. See the Xorg Wikipedia article or visit the Xorg website for more details.

Installation

Xorg can be installed with the xorg-server package.

Additionally, some packages from the xorg-server-utils meta-package are necessary for certain configuration tasks, they are pointed out in the relevant sections. Other useful packages are in the xorg-apps group.

Tip: You will typically seek to install a window manager or a desktop environment to supplement X.

Driver installation

The Linux kernel includes open-source video drivers and support for hardware accelerated framebuffers. However, userland support is required for OpenGL and 2D acceleration in X11.

First, identify your card:

$ lspci | grep -e VGA -e 3D

Then install an appropriate driver. You can search the package database for a complete list of open-source video drivers:

$ pacman -Ss xf86-video

Xorg searches for installed drivers automatically:

  • If it cannot find the specific driver installed for the hardware (listed below), it first searches for fbdev (xf86-video-fbdev).
  • If that is not found, it searches for vesa (xf86-video-vesa), the generic driver, which handles a large number of chipsets but does not include any 2D or 3D acceleration.
  • If vesa is not found, Xorg will fall back to kernel mode setting, which includes GLAMOR acceleration (see man modesetting).

In order for video acceleration to work, and often to expose all the modes that the GPU can set, a proper video driver is required:

Brand Type Driver OpenGL OpenGL (Multilib) Documentation
AMD/
ATI
Open source xf86-video-amdgpu mesa-libgl lib32-mesa-libgl AMDGPU
xf86-video-ati ATI
Proprietary catalystAUR catalyst-libglAUR lib32-catalyst-libglAUR AMD Catalyst
Intel Open source xf86-video-intel mesa-libgl lib32-mesa-libgl Intel graphics
Nvidia Open source xf86-video-nouveau mesa-libgl lib32-mesa-libgl Nouveau
Proprietary nvidia nvidia-libgl lib32-nvidia-libgl NVIDIA
nvidia-340xx nvidia-340xx-libgl lib32-nvidia-340xx-libgl
nvidia-304xx nvidia-304xx-libgl lib32-nvidia-304xx-libgl
Note: For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see NVIDIA Optimus or Bumblebee.

Other video drivers can be found in the xorg-drivers group.

Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games.

ATI

GPU architecture Radeon cards Open-source driver Proprietary driver
GCN 43 RX 400 AMDGPU AMDGPU PRO
GCN 3 various AMDGPU Catalyst /
AMDGPU PRO
GCN 2 various ATI2 Catalyst2
GCN 1 various ATI1 Catalyst1
TeraScale 2&3 HD 5000 - HD 6000 ATI Catalyst
TeraScale 1 HD 2000 - HD 4000 Catalyst legacy
Older X1000 and older not available
1: experimental AMDGPU support coming in Linux 4.8
2: experimental AMDGPU support
3: linux>=4.7

Running

Display manager

A convenient way to start X, but one that requires an additional application and dependencies, is by using a display manager.

Manually

To start the X server without a display manager, see xinit.

Configuration

Note: Arch supplies default configuration files in /usr/share/X11/xorg.conf.d, and no extra configuration is necessary for most setups.

Xorg uses a configuration file called xorg.conf and files ending in the suffix .conf for its initial setup: the complete list of the folders where these files are searched can be found at [1] or by running man xorg.conf, together with a detailed explanation of all the available options.

Using .conf files

The /etc/X11/xorg.conf.d/ directory stores host-specific configuration. You are free to add configuration files there, but they must have a .conf suffix: the files are read in ASCII order, and by convention their names start with XX- (two digits and a hyphen, so that for example 10 is read before 20). These files are parsed by the X server upon startup and are treated like part of the traditional xorg.conf configuration file. The X server essentially treats the collection of configuration files as one big file with entries from xorg.conf at the end.

For option examples to set, see also the fedora wiki.

Using xorg.conf

Xorg can also be configured via /etc/X11/xorg.conf or /etc/xorg.conf. You can also generate a skeleton for xorg.conf with:

# Xorg :0 -configure

This should create a xorg.conf.new file in /root/ that you can copy over to /etc/X11/xorg.conf.

Tip: If you are already running an X server, use a different display, for example Xorg :2 -configure.

Alternatively, your proprietary video card drivers may come with a tool to automatically configure Xorg: see the article of your video driver, NVIDIA or AMD Catalyst, for more details.

Note: Configuration file keywords are case insensitive, and "_" characters are ignored. Most strings (including Option names) are also case insensitive, and insensitive to white space and "_" characters.

Input devices

For input devices, the virtual package xf86-input-driver ensures at least one input driver of either xf86-input-evdev or xf86-input-libinput is installed.[2]

Udev, which is provided as a systemd dependency, will detect your hardware and both drivers will act as hotplugging input driver for almost all devices, as defined in the default configuration files 10-evdev.conf and 60-libinput.conf in the /usr/share/X11/xorg.conf.d/ directory.

After starting X server, the log file will show which driver hotplugged for the individual devices (note the most recent log file name may vary):

$ grep -e "Using input driver " ~/.local/share/xorg/Xorg.0.log

If both do not support a particular device, install the needed driver from the xorg-drivers group. The same applies, if you want to use another driver.

To influence hotplugging, see #Configuration.

For specific instructions, see also the libinput article, the following pages below, or the Fedora wiki entry for more examples.

Mouse acceleration

See Mouse acceleration.

Extra mouse buttons

See All Mouse Buttons Working.

Touchpad

See Synaptics or libinput.

Touchscreen

See Touchscreen.

Keyboard settings

See Keyboard configuration in Xorg.

Monitor settings

Getting started

Note: Newer versions of Xorg are auto-configuring, you should not need to use this.

First, create a new config file, such as /etc/X11/xorg.conf.d/10-monitor.conf.

/etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
    Identifier             "Monitor0"
EndSection

Section "Device"
    Identifier             "Device0"
    Driver                 "vesa" #Choose the driver used for this monitor
EndSection

Section "Screen"
    Identifier             "Screen0"  #Collapse Monitor and Device section to Screen section
    Device                 "Device0"
    Monitor                "Monitor0"
    DefaultDepth           16 #Choose the depth (16||24)
    SubSection             "Display"
        Depth              16
        Modes              "1024x768_75.00" #Choose the resolution
    EndSubSection
EndSection
Note: By default, Xorg needs to be able to detect a monitor and will not start otherwise. A workaround is to create a configuration file such as the example above and thus avoid auto-configuring. A common case where this is necessary is a headless system, which boots without a monitor and starts Xorg automatically, either from a virtual console at login, or from a display manager.

Multiple monitors

See main article Multihead for general information.

See also GPU-specific instructions:

More than one graphics card

You must define the correct driver to use and put the bus ID of your graphic cards.

Section "Device"
    Identifier             "Screen0"
    Driver                 "nouveau"
    BusID                  "PCI:0:12:0"
EndSection

Section "Device"
    Identifier             "Screen1"
    Driver                 "radeon"
    BusID                  "PCI:1:0:0"
EndSection

To get your bus ID:

$ lspci | grep VGA
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)

The bus ID here is 1:0:0.

Display size and DPI

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Xorg always sets dpi to 96. See this, this and finally this. (Discuss in Talk:Xorg#)

The DPI of the X server is determined in the following manner:

  1. The -dpi command line option has highest priority.
  2. If this is not used, the DisplaySize setting in the X config file is used to derive the DPI, given the screen resolution.
  3. If no DisplaySize is given, the monitor size values from DDC are used to derive the DPI, given the screen resolution.
  4. If DDC does not specify a size, 75 DPI is used by default.

In order to get correct dots per inch (DPI) set, the display size must be recognized or set. Having the correct DPI is especially necessary where fine detail is required (like font rendering). Previously, manufacturers tried to create a standard for 96 DPI (a 10.3" diagonal monitor would be 800x600, a 13.2" monitor 1024x768). These days, screen DPIs vary and may not be equal horizontally and vertically. For example, a 19" widescreen LCD at 1440x900 may have a DPI of 89x87. To be able to set the DPI, the Xorg server attempts to auto-detect your monitor's physical screen size through the graphic card with DDC. When the Xorg server knows the physical screen size, it will be able to set the correct DPI depending on resolution size.

To see if your display size and DPI are detected/calculated correctly:

$ xdpyinfo | grep -B2 resolution

Check that the dimensions match your display size. If the Xorg server is not able to correctly calculate the screen size, it will default to 75x75 DPI and you will have to calculate it yourself.

If you have specifications on the physical size of the screen, they can be entered in the Xorg configuration file so that the proper DPI is calculated:

Section "Monitor"
    Identifier             "Monitor0"
    DisplaySize             286 179    # In millimeters
EndSection

If you only want to enter the specification of your monitor without creating a full xorg.conf create a new config file. For example (/etc/X11/xorg.conf.d/90-monitor.conf):

Section "Monitor"
    Identifier             "<default monitor>"
    DisplaySize            286 179    # In millimeters
EndSection

If you do not have specifications for physical screen width and height (most specifications these days only list by diagonal size), you can use the monitor's native resolution (or aspect ratio) and diagonal length to calculate the horizontal and vertical physical dimensions. Using the Pythagorean theorem on a 13.3" diagonal length screen with a 1280x800 native resolution (or 16:10 aspect ratio):

$ echo 'scale=5;sqrt(1280^2+800^2)' | bc  # 1509.43698

This will give the pixel diagonal length and with this value you can discover the physical horizontal and vertical lengths (and convert them to millimeters):

$ echo 'scale=5;(13.3/1509)*1280*25.4' | bc  # 286.43072
$ echo 'scale=5;(13.3/1509)*800*25.4'  | bc  # 179.01920
Note: This calculation works for monitors with square pixels; however, there is the seldom monitor that may compress aspect ratio (e.g 16:10 aspect resolution to a 16:9 monitor). If this is the case, you should measure your screen size manually.

Setting DPI manually

Note: While you can set any dpi you like and applications using Qt and GTK will scale accordingly, it's recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUI that use bitmaps. Reducing it below 96 dpi may not reduce size of graphical elements of GUI as typically the lowest dpi the icons are made for is 96.

For RandR compliant drivers (for example the open source ATI driver), you can set it by:

$ xrandr --dpi 144
Note: Applications that comply with the setting will not change immediately. You have to start them anew.

See Execute commands after X start to make it permanent.

Proprietary NVIDIA driver

DPI can be set manually if you only plan to use one resolution (DPI calculator):

Section "Monitor"
    Identifier             "Monitor0"
    Option                 "DPI" "96 x 96"
EndSection

You can manually set the DPI adding the options below on /etc/X11/xorg.conf.d/20-nvidia.conf (inside Device section):

Option              "UseEdidDpi" "False"
Option              "DPI" "96 x 96"

DPMS

DPMS (Display Power Management Signaling) is a technology that allows power saving behaviour of monitors when the computer is not in use. This will allow you to have your monitors automatically go into standby after a predefined period of time.

Composite

The Composite extension for X causes an entire sub-tree of the window hierarchy to be rendered to an off-screen buffer. Applications can then take the contents of that buffer and do whatever they like. The off-screen buffer can be automatically merged into the parent window or merged by external programs, called compositing managers. See the following article for more information: compositing window manager

Some window managers (e.g. Compiz, Enlightenment, KWin, Marco, Metacity, Muffin, Mutter, Xfwm) do compositing on their own. For other window managers, a standalone composite manager can be used.

List of composite managers

http://cairo-compmgr.tuxfamily.org/ || cairo-compmgr-gitAUR
  • Compton — Compositor (a fork of xcompmgr-dana)
https://github.com/chjj/compton || compton
  • Xcompmgr — Composite window-effects manager
http://cgit.freedesktop.org/xorg/app/xcompmgr/ || xcompmgr
  • Unagi — Modular compositing manager which aims written in C and based on XCB
http://projects.mini-dweeb.org/projects/unagi || unagiAUR

Tips and tricks

X startup tweaking (startx)

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: /usr/bin/startx should not be modified, startx recognises the options as command line arguments (Discuss in Talk:Xorg#)

For X's option reference see:

$ man Xserver

The following options have to be appended to the variable "defaultserverargs" in the /usr/bin/startx file:

  • Enable deferred glyph loading for 16 bit fonts:
-deferglyphs 16
Note: If you start X with kdm, the startx script does not seem to be executed. X options must be appended to the variable ServerArgsLocal in the /usr/share/config/kdm/kdmrc file.

Nested X session

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: mention xephyr (Discuss in Talk:Xorg#)

To run a nested session of another desktop environment:

$ /usr/bin/Xnest :1 -geometry 1024x768+0+0 -ac -name Windowmaker & wmaker -display :1

This will launch a Window Maker session in a 1024 by 768 window within your current X session.

This needs the package xorg-server-xnest to be installed.

Starting GUI programs remotely

See main article: SSH#X11 forwarding.

On-demand disabling and enabling of input sources

With the help of xinput you can temporarily disable or enable input sources. This might be useful, for example, on systems that have more than one mouse, such as the ThinkPads and you would rather use just one to avoid unwanted mouse clicks.

Install the xorg-xinput package from the official repositories.

Find the name or ID of the device you want to disable:

$ xinput

For example in a Lenovo ThinkPad T500, the output looks like this:

$ xinput
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=11   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=10   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=12   [slave  keyboard (3)]

Disable the device with xinput --disable device, where device is the device ID or name of the device you want to disable. In this example we will disable the Synaptics Touchpad, with the ID 10:

$ xinput --disable 10

To re-enable the device, just issue the opposite command:

$ xinput --enable 10

Alternatively using the device name, the command to disable the touchpad would be:

$ xinput --disable "SynPS/2 Synaptics TouchPad"

Killing application with hotkey

Run script on hotkey:

#!/bin/bash
windowFocus=$(xdotool getwindowfocus);
pid=$(xprop -id $windowFocus | grep PID);
kill -9 $pid

Deps: xorg-xprop, xdotool

Troubleshooting

General

If a problem occurs, view the log stored in either /var/log/ or, for the rootless X default since v1.16, in ~/.local/share/xorg/. GDM users should check the systemd journal. [3]

The logfiles are of the form Xorg.n.log with n being the display number. For a single user machine with default configuration the applicable log is frequently Xorg.0.log, but otherwise it may vary. To make sure to pick the right file it may help to look at the timestamp of the X server session start and from which console it was started. For example:

$ grep -e Log -e tty Xorg.0.log
[    40.623] (==) Log file: "/home/archuser/.local/share/xorg/Xorg.0.log", Time: Thu Aug 28 12:36:44 2014
[    40.704] (--) controlling tty is VT number 1, auto-enabling KeepTty
  • In the logfile then be on the lookout for any lines beginning with (EE), which represent errors, and also (WW), which are warnings that could indicate other issues.
  • If there is an empty .xinitrc file in your $HOME, either delete or edit it in order for X to start properly. If you do not do this X will show a blank screen with what appears to be no errors in your Xorg.0.log. Simply deleting it will get it running with a default X environment.
  • If the screen goes black, you may still attempt to switch to a different virtual console (e.g. Ctrl+Alt+F2), and blindly log in as root. You can do this by typing root (press Enter after typing it) and entering the root password (again, press Enter after typing it).
You may also attempt to kill the X server with:
# pkill X
If this does not work, reboot blindly with:
# reboot

Black screen, No protocol specified.., Resource temporarily unavailable for all or some users

X creates configuration and temporary files in current user's home directory. Make sure there is free disk space available on the partition your home directory resides in. Unfortunately, X server does not provide any more obvious information about lack of disk space in this case.

CTRL right key does not work with oss keymap

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The file will be overwritten on xkeyboard-config update; for such simple task should be used Xmodmap. (Discuss in Talk:Xorg#)

Edit as root /usr/share/X11/xkb/symbols/fr, and change the line:

include "level5(rctrl_switch)"

to

// include "level5(rctrl_switch)"

Then restart X, reboot or run

setxkbmap fr oss

DRI with Matrox cards stops working

If you use a Matrox card and DRI stops working after upgrading to Xorg, try adding the line:

Option "OldDmaInit" "On"

to the Device section that references the video card in xorg.conf.

Frame-buffer mode problems

If X fails to start with the following log messages,

(WW) Falling back to old probe method for fbdev
(II) Loading sub module "fbdevhw"
(II) LoadModule: "fbdevhw"
(II) Loading /usr/lib/xorg/modules/linux//libfbdevhw.so
(II) Module fbdevhw: vendor="X.Org Foundation"
       compiled for 1.6.1, module version=0.0.2
       ABI class: X.Org Video Driver, version 5.0
(II) FBDEV(1): using default device

Fatal server error:
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices

Uninstall the xf86-video-fbdev package.

Launching multiple X sessions with proprietary NVIDIA on Xorg 1.16

When attempting to launch X sessions in multiple ttys on Xorg 1.16, you may be rejected with a log indicating that no drivers were found. I found that a workaround for this was to specifically tell X that we'd like to use the 'nvidia' driver.

/etc/X11/xorg.conf.d/20-nvidia.conf

Section "Device"
    Identifier "Device0"
    Driver     "nvidia"
    VendorName "NVIDIA Corporation"
    Option     "NoLogo" "True"
EndSection

Program requests "font '(null)'"

  • Error message: "unable to load font `(null)'."

Some programs only work with bitmap fonts. Two major packages with bitmap fonts are available, xorg-fonts-75dpi and xorg-fonts-100dpi. You do not need both; one should be enough. To find out which one would be better in your case, try this:

$ xdpyinfo | grep resolution

and use what is closer to the shown value.

Recovery: disabling Xorg before GUI login

If Xorg is set to boot up automatically and for some reason you need to prevent it from starting up before the login/display manager appears (if the system is wrongly configured and Xorg does not recognize your mouse or keyboard input, for instance), you can accomplish this task with two methods.

  • Change default target to rescue.target. See systemd#Change default target to boot into.
  • If you have not only a faulty system that makes Xorg unusable, but you have also set the GRUB menu wait time to zero, or cannot otherwise use GRUB to prevent Xorg from booting, you can use the Arch Linux live CD. Follow the installation guide about how to mount and chroot into the installed Arch Linux. Alternatively try to switch into another tty with Ctrl+Alt + function key (usually from F1 to F7 depending on which is not used by X), login as root and follow steps below.

Depending on setup, you will need to do one or more of these steps:

X clients started with "su" fail

If you are getting "Client is not authorized to connect to server", try adding the line:

session        optional        pam_xauth.so

to /etc/pam.d/su. pam_xauth will then properly set environment variables and handle xauth keys.

X failed to start: Keyboard initialization failed

If your hard disk is full, startx will fail. /var/log/Xorg.0.log will end with:

(EE) Error compiling keymap (server-0)
(EE) XKB: Could not compile keymap
(EE) XKB: Failed to load keymap. Loading default keymap instead.
(EE) Error compiling keymap (server-0)
(EE) XKB: Could not compile keymap
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
Fatal server error:
Failed to activate core devices.
Please consult the The X.Org Foundation support at http://wiki.x.org
for help.
Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(II) AIGLX: Suspending AIGLX clients for VT switch

Make some free space on your root partition and X will start.

Rootless Xorg (v1.16)

As of version 1.16 [4], Xorg may run with standard user privileges with the help of logind. The requirements for this are:

  • systemd; version >=216 for multiple instances
  • Starting X via xinit; display managers are not supported
  • Kernel mode setting; implementations in proprietary display drivers fail auto-detection and require manually setting needs_root_rights = no in /etc/X11/Xwrapper.config.

If you do not fit these requirements, re-enable root rights in /etc/X11/Xwrapper.config:

needs_root_rights = yes

See also Xorg.wrap(1) and Systemd/User#Xorg as a systemd user service.

Broken redirection

While user Xorg logs are stored in ~/.local/share/xorg/Xorg.log, they do not include the output from the X session. To re-enable redirection, start X with the -keeptty flag:

exec startx -- -keeptty -nolisten tcp > ~/.xorg.log 2>&1

Or copy /etc/X11/xinit/xserverrc to ~/.xserverrc, and append -keeptty. See [5].

Why do I get a green screen whenever I try to watch a video?

Your color depth is set wrong. It may need to be 24 instead of 16, for example.

SocketCreateListener error

If X terminates with error message "SocketCreateListener() failed", you may need to delete socket files in /tmp/.X11-unix. This may happen if you have previously run Xorg as root (e.g. to generate an xorg.conf).