Xorg: Difference between revisions

From ArchWiki
(→‎AMD: take the translation of model names to architectures out of the table as it is shared between all rows)
(→‎List of composite managers: Remove entry for compfy, see https://github.com/allusive-dev/compfy/issues/61)
 
(139 intermediate revisions by 27 users not shown)
Line 1: Line 1:
[[Category:X server]]
[[Category:X server]]
[[cs:Xorg]]
[[da:Xorg]]
[[de:X]]
[[de:X]]
[[el:Xorg]]
[[es:Xorg]]
[[fr:Xorg]]
[[fr:Xorg]]
[[it:Xorg]]
[[ja:Xorg]]
[[ja:Xorg]]
[[nl:Xorg]]
[[pl:Xorg]]
[[pt:Xorg]]
[[pt:Xorg]]
[[ru:Xorg]]
[[ru:Xorg]]
[[uk:Xorg]]
[[uk:Xorg]]
[[zh-hans:Xorg]]
[[zh-hans:Xorg]]
[[zh-hant:Xorg]]
{{Related articles start}}
{{Related articles start}}
{{Related|Autostarting}}
{{Related|Autostarting}}
Line 31: Line 23:


'''Xorg''' (commonly referred to as simply '''X''') 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 [https://www.x.org/wiki/ Xorg website] for more details.
'''Xorg''' (commonly referred to as simply '''X''') 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 [https://www.x.org/wiki/ Xorg website] for more details.
For the alternative and successor, see [[Wayland]].


== Installation ==
== Installation ==
Line 36: Line 30:
Xorg can be [[install]]ed with the {{Pkg|xorg-server}} package.
Xorg can be [[install]]ed with the {{Pkg|xorg-server}} package.


Additionally, some packages from the {{Grp|xorg-apps}} group are necessary for certain configuration tasks, they are pointed out in the relevant sections.
Additionally, some packages from the {{Grp|xorg-apps}} group are necessary for certain configuration tasks. They are pointed out in the relevant sections.


Finally, an {{Grp|xorg}} group is also available, which includes Xorg server packages, packages from the {{Grp|xorg-apps}} group and fonts.  
Finally, an {{Grp|xorg}} group is also available, which includes Xorg server packages, packages from the {{Grp|xorg-apps}} group and fonts.
 
{{Tip|You will typically seek to install a [[window manager]] or a [[desktop environment]] to supplement X.}}


=== Driver installation ===
=== 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.
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 the graphics card (the ''Subsystem'' output shows the specific model):
First, identify the graphics card (the ''Subsystem'' output shows the specific model):
Line 50: Line 42:
  $ lspci -v | grep -A1 -e VGA -e 3D
  $ lspci -v | grep -A1 -e VGA -e 3D


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


  $ pacman -Ss xf86-video
  $ pacman -Ss xf86-video
Line 56: Line 48:
Xorg searches for installed drivers automatically:
Xorg searches for installed drivers automatically:


* If it cannot find the specific driver installed for the hardware (listed below), it first searches for ''fbdev'' ({{pkg|xf86-video-fbdev}}).
* If it cannot find the specific driver installed for the hardware (listed below), it first searches for ''fbdev'' ({{pkg|xf86-video-fbdev}}), which does not include any 2D or 3D acceleration.
* 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 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 {{man|4|modesetting}}).
* If ''vesa'' is not found, Xorg will fall back to [[kernel mode setting]], which includes GLAMOR acceleration (see {{man|4|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:
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:
{{Expansion|How does {{Pkg|nvidia-open}} fit into here? Does it use the same OpenGL/Vulkan drivers provided in {{Pkg|nvidia-utils}}?}}


{| class="wikitable"  style="text-align:center"
{| class="wikitable"  style="text-align:center"
|-
|-
! Brand !! Type !! Driver !! OpenGL !! OpenGL ([[multilib]]) !! Documentation
! Brand
! Type
! Documentation
! Driver
! OpenGL
! OpenGL ([[multilib]])
! Vulkan
! Vulkan ([[multilib]])
|-
|-
! rowspan="3" | AMD / ATI
| rowspan="3" | AMD (ex-ATI)
| rowspan="2" | Open source || {{Pkg|xf86-video-amdgpu}} || rowspan="2" | {{Pkg|mesa}} || rowspan="2" | {{Pkg|lib32-mesa}} || [[AMDGPU]]
| rowspan="2" | Open source
| [[AMDGPU]]
| {{Pkg|xf86-video-amdgpu}}
| rowspan="2" | {{Pkg|mesa}}
| rowspan="2" | {{Pkg|lib32-mesa}}
| {{Pkg|vulkan-radeon}} / {{Pkg|amdvlk}}<sup>4</sup>
| {{Pkg|lib32-vulkan-radeon}} / {{Pkg|lib32-amdvlk}}<sup>4</sup>
|-
|-
| {{Pkg|xf86-video-ati}} || [[ATI]]
| [[ATI]]
| {{Pkg|xf86-video-ati}}
| colspan="2" | None
|-
|-
| Proprietary || {{Pkg|xf86-video-amdgpu}} || {{AUR|amdgpu-pro-libgl}} || {{AUR|lib32-amdgpu-pro-libgl}} || [[AMDGPU PRO]]
| Proprietary
| [[AMDGPU PRO]]
| {{Pkg|xf86-video-amdgpu}}
| {{AUR|amdgpu-pro-oglp}}
| {{AUR|lib32-amdgpu-pro-oglp}}
| {{AUR|vulkan-amdgpu-pro}}
| {{AUR|lib32-vulkan-amdgpu-pro}}
|-
|-
! Intel
| Intel
| Open source || {{Pkg|xf86-video-intel}} || {{Pkg|mesa}} || {{Pkg|lib32-mesa}} || [[Intel graphics]]
| Open source
| [[Intel graphics]]
| {{Pkg|xf86-video-intel}}<sup>2</sup>
| {{Pkg|mesa}} or {{Pkg|mesa-amber}}<sup>3</sup>
| {{Pkg|lib32-mesa}}
| {{Pkg|vulkan-intel}}
| {{Pkg|lib32-vulkan-intel}}
|-
|-
! rowspan="3" | NVIDIA
| rowspan="4" | NVIDIA
| Open source || {{Pkg|xf86-video-nouveau}} || {{Pkg|mesa}} || {{Pkg|lib32-mesa}} || [[Nouveau]]
| Open source
| [[Nouveau]]<sup>1</sup>
| {{Pkg|xf86-video-nouveau}}
| {{Pkg|mesa}}
| {{Pkg|lib32-mesa}}
| colspan="2" | None<sup>5</sup>
|-
|-
| rowspan="2" | Proprietary || {{Pkg|nvidia}} || {{Pkg|nvidia-utils}} || {{Pkg|lib32-nvidia-utils}} || rowspan="2" | [[NVIDIA]]
| rowspan="3" | Proprietary
| rowspan="3" | [[NVIDIA]]<sup>1</sup>
| {{Pkg|nvidia}}
| {{Pkg|nvidia-utils}}
| {{Pkg|lib32-nvidia-utils}}
| {{Pkg|nvidia-utils}}
| {{Pkg|lib32-nvidia-utils}}
|-
|-
| {{AUR|nvidia-390xx}} || {{AUR|nvidia-390xx-utils}} || {{AUR|lib32-nvidia-390xx-utils}}
| {{AUR|nvidia-470xx-dkms}}
| {{AUR|nvidia-470xx-utils}}
| {{AUR|lib32-nvidia-470xx-utils}}
| {{AUR|nvidia-470xx-utils}}
| {{AUR|lib32-nvidia-470xx-utils}}
|-
| {{AUR|nvidia-390xx-dkms}}
| {{AUR|nvidia-390xx-utils}}
| {{AUR|lib32-nvidia-390xx-utils}}
| {{AUR|nvidia-390xx-utils}}
| {{AUR|lib32-nvidia-390xx-utils}}
|}
|}


{{Note|
# For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see [[NVIDIA Optimus]].
* For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see [[NVIDIA Optimus]].
# For Intel graphics on 4th generation and above, see [[Intel graphics#Installation]] for available drivers.
* For Intel graphics on 4th generation and above, see [[Intel graphics#Installation]] for available drivers.
# Classic OpenGL (non-Gallium3D) drivers for older hardware (Mesa 22.0 and higher have dropped support for i915 classic driver)
}}
# {{Pkg|vulkan-radeon}} / {{Pkg|lib32-vulkan-radeon}} is recommended over {{Pkg|amdvlk}} / {{Pkg|lib32-amdvlk}} (see [[AMDGPU#Installation]]).
# [https://www.collabora.com/news-and-blog/news-and-events/introducing-nvk.html NVK], the experimental open source Vulkan driver for Nvidia GPUs, is [https://www.collabora.com/news-and-blog/news-and-events/nvk-has-landed.html expected to be included] in {{Pkg|mesa}} 23.3


Other video drivers can be found in the {{Grp|xorg-drivers}} group.
Other video drivers can be found in the {{Grp|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. The exceptions to this rule are recent GPUs (especially NVIDIA GPUs), that are not supported by the open source drivers.
Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games. The exceptions to this rule are recent GPUs (especially NVIDIA GPUs) not supported by open source drivers.


==== AMD ====
==== AMD ====


For a translation of model names (e.g. ''Radeon RX 6800'') to GPU architectures (e.g. ''RDNA 2''), see [[wikipedia:List of AMD graphics processing units]].
For a translation of model names (e.g. ''Radeon RX 6800'') to GPU architectures (e.g. ''RDNA 2''), see [[Wikipedia:List of AMD graphics processing units#Features overview]].


{| class="wikitable"  style="text-align:center"
{| class="wikitable"  style="text-align:center"
Line 101: Line 144:
! GPU architecture !! Open-source driver !! Proprietary driver
! GPU architecture !! Open-source driver !! Proprietary driver
|-
|-
| RDNA, RDNA 2 || rowspan=2 | [[AMDGPU]] || rowspan=2 | [[AMDGPU PRO]]
| RDNA and later || rowspan=2 | [[AMDGPU]] || rowspan=2 | [[AMDGPU PRO]]
|-
|-
| GCN 3, GCN 4, GCN 5
| GCN 3 and later
|-  
|-  
| GCN 1, GCN 2 || [[AMDGPU]]* / [[ATI]] || ''not available''
| GCN 1&2 || [[AMDGPU]]<sup>1</sup> / [[ATI]] || ''not available''
|-  
|-  
| TeraScale<br/>and older || [[ATI]] || ''not available''
| TeraScale<br/>and older || [[ATI]] || ''not available''
|-
|-
|}
|}
: *: Experimental
 
# Experimental.


== Running ==
== Running ==


The {{man|1|Xorg}} command is usually not run directly, instead the X server is started with either a [[display manager]] or [[xinit]].
The {{man|1|Xorg}} command is usually not run directly. Instead, the X server is started with either a [[display manager]] or [[xinit]].
 
{{Tip|You will typically seek to install a [[window manager]] or a [[desktop environment]] to supplement X.}}


== Configuration ==
== Configuration ==
Line 124: Line 170:
=== Using .conf files ===
=== Using .conf files ===


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. Note that on conflicting configuration, the file read ''last'' will be processed. For that reason the most generic configuration files should be ordered first by name. The configuration entries in the {{ic|xorg.conf}} file are processed at the end.  
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. Note that on conflicting configuration, the file read ''last'' will be processed. For this reason, the most generic configuration files should be ordered first by name. The configuration entries in the {{ic|xorg.conf}} file are processed at the end.  


For option examples to set, see also the [https://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d Fedora wiki].
For option examples to set, see [[Fedora:Input device configuration#xorg.conf.d]].


=== Using xorg.conf ===
=== Using xorg.conf ===
Line 155: Line 201:
To influence hotplugging, see [[#Configuration]].  
To influence hotplugging, see [[#Configuration]].  


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.
For specific instructions, see also the [[libinput]] article, the following pages below, or [[Fedora:Input device configuration]] for more examples.


=== Input identification ===
=== Input identification ===
Line 190: Line 236:
}}
}}


For a headless configuration the {{pkg|xf86-video-dummy}} driver is necessary; [[install]] it and create a configuration file, such as the following:
For a headless configuration, the {{pkg|xf86-video-dummy}} driver is necessary; [[install]] it and create a configuration file, such as the following:


{{hc|/etc/X11/xorg.conf.d/10-headless.conf|
{{hc|/etc/X11/xorg.conf.d/10-headless.conf|
Line 218: Line 264:


See main article [[Multihead]] for general information.
See main article [[Multihead]] for general information.
See also GPU-specific instructions:
* [[NVIDIA#Multiple monitors]]
* [[Nouveau#Dual head]]
* [[ATI#Multihead setup]]


==== More than one graphics card ====
==== More than one graphics card ====
Line 250: Line 290:
}}
}}


The bus IDs here are 0:2:0 and 1:0:0.
The bus IDs here are {{ic|0:2:0}} and {{ic|1:0:0}}.


=== Display size and DPI ===
=== Display size and DPI ===


{{Accuracy|1=Xorg always sets dpi to 96. See [https://bugs.freedesktop.org/show_bug.cgi?id=23705 this], [https://gitlab.freedesktop.org/xorg/xserver/issues/253 this] and finally [https://pastebin.com/vtzyBK6e this].}}
By default, Xorg always sets DPI to 96 since 2009 (see [https://bugs.freedesktop.org/show_bug.cgi?id=23705]). A change was made with version 21.1 to provide proper DPI auto-detection, but reverted (see {{Bug|72661}}).


The DPI of the X server is determined in the following manner:
The DPI of the X server can be set with the {{ic|-dpi}} command line option.


# The {{ic|-dpi}} command line option has highest priority.
Having the correct DPI is helpful 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.
# If this is not used, the {{ic|DisplaySize}} setting in the X config file is used to derive the DPI, given the screen resolution.
# If no {{ic|DisplaySize}} is given, the monitor size values from [[Wikipedia:Display Data Channel|DDC]] are used to derive the DPI, given the screen resolution.
# 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.  <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 correct:
 
To see if your display size and DPI are detected/calculated correctly:


  $ xdpyinfo | grep -B2 resolution
  $ 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.
Check that the dimensions match your display size.


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 (adjust identifier to your xrandr output) :
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 (adjust identifier to your xrandr output):


{{bc|
{{bc|
Line 280: Line 315:
}}
}}


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


{{bc|
{{bc|
Line 291: Line 326:
{{Note|If you are using the proprietary NVIDIA driver, you may have to put {{ic|Option "UseEdidDpi" "FALSE"}} under {{ic|Device}} or {{ic|Screen}} section to make it take effect.}}
{{Note|If you are using the proprietary NVIDIA driver, you may have to put {{ic|Option "UseEdidDpi" "FALSE"}} under {{ic|Device}} or {{ic|Screen}} section to make it take effect.}}


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


  $ 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


{{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 rare 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.}}
{{Note|While you can set any dpi you like and applications using Qt and GTK will scale accordingly, it is recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUIs that use bitmaps. Reducing it below 96 dpi may not reduce the size of the GUIs graphical elements, 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:
For RandR compliant drivers (for example the open source ATI driver), you can set it by:
Line 325: Line 360:
  $ xrdb -query | grep dpi
  $ xrdb -query | grep dpi


With GTK library versions since 3.16, when this variable is not otherwise explicitly set, GTK sets it to 96. To have GTK apps obey the server DPI you may need to explictly set Xft.dpi to the same value as the server. The Xft.dpi resource is the method by which some desktop environments optionally force DPI to a particular value in personal settings. Among these are [[KDE]] and [[TDE]].
With GTK library versions since 3.16, when this variable is not otherwise explicitly set, GTK sets it to 96. To have GTK apps obey the server DPI you may need to explicitly set {{ic|Xft.dpi}} to the same value as the server. The {{ic|Xft.dpi}} resource is the method by which some desktop environments optionally force DPI to a particular value in personal settings. Among these are [[KDE]] and [[TDE]].


=== Display Power Management ===
=== Display Power Management ===


[[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.
[[DPMS]] 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 ==
== 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: [[Wikipedia:Compositing window manager|compositing window manager]]
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. For more information, see [[Wikipedia: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.
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.
Line 339: Line 374:
=== List of composite managers ===
=== List of composite managers ===


* {{App|[[Picom]]|Compositor (a fork of Compton)|https://github.com/yshui/picom|{{Pkg|picom}}}}
* {{App|[[Picom]]|Lightweight compositor with shadowing, advanced blurring and fading. Forked from Compton.|https://github.com/yshui/picom|{{Pkg|picom}}}}
* {{App|[[Xcompmgr]]|Composite window-effects manager|https://cgit.freedesktop.org/xorg/app/xcompmgr/|{{Pkg|xcompmgr}}}}
* {{App|[[Xcompmgr]]|Composite window-effects manager.|https://gitlab.freedesktop.org/xorg/app/xcompmgr/|{{Pkg|xcompmgr}}}}
* {{App|Unagi|Modular compositing manager which aims to be efficient, lightweight and responsive. It is written in C and based on XCB|https://projects.mini-dweeb.org/projects/unagi|{{AUR|unagi}}}}
* {{App|[[Gamescope]]|The micro-compositor from Valve, with gaming-oriented features such as FSR upscaling. Forked from steamos-compositor.|https://github.com/ValveSoftware/gamescope|{{Pkg|gamescope}}}}
* {{App|steamos-compositor-plus|Valve's compositor, with some added tweaks and fixes.|https://github.com/chimeraos/steamos-compositor-plus|{{AUR|steamos-compositor-plus}}}}


== Tips and tricks ==
== Tips and tricks ==
{{Expansion|Mention {{Pkg|xorg-xkill}}.}}


=== Automation ===
=== Automation ===
Line 355: Line 389:
|-
|-
! xautomation
! xautomation
| {{Pkg|xautomation}} || {{man|1|xte}} || {{Yes}} || {{No}} || Also contains screen scraping tools. Cannot simulate F13+.
| {{Pkg|xautomation}} || {{man|1|xte}} || {{Yes}} || {{No}} || Also contains screen scraping tools. Cannot simulate {{ic|F13}} and more.
|-
|-
! xdo
! xdo
Line 373: Line 407:


=== Nested X session ===
=== Nested X session ===
{{Expansion|mention [[Awesome#Using_Xephyr|xephyr]]}}


To run a nested session of another desktop environment:
To run a nested session of another desktop environment:
Line 383: Line 415:


This needs the package {{Pkg|xorg-server-xnest}} to be installed.
This needs the package {{Pkg|xorg-server-xnest}} to be installed.
A more modern way of doing a nested X session is with [[Xephyr]].
=== Starting an application without a window manager ===
See [[xinit#Starting applications without a window manager]].


=== Starting GUI programs remotely ===
=== Starting GUI programs remotely ===
Line 425: Line 463:


  $ xinput --disable "SynPS/2 Synaptics TouchPad"
  $ xinput --disable "SynPS/2 Synaptics TouchPad"
=== Persistently disable input source ===
You can disable a particular input source using a configuration snippet:
{{hc|/etc/X11/xorg.conf.d/30-disable-''device''.conf|
Section "InputClass"
      Identifier  "disable-''device''"
      Driver      "''driver_name''"
      MatchProduct "''device_name''"
      Option      "Ignore" "True"
EndSection
}}
{{ic|''device''}} is an arbitrary name, and {{ic|''driver_name''}} is the name of the input driver, e.g. {{ic|libinput}}. {{ic|''device_name''}} is what is actually used to match the proper device. For alternate methods of targeting the correct device, such as [[libinput]]'s {{ic|MatchIsTouchscreen}}, consult your input driver's documentation. Though this example uses libinput, this is a driver-agnostic method which simply prevents the device from being propagated to the driver.


=== Killing application with hotkey ===
=== Killing application with hotkey ===
Line 430: Line 483:
Run script on hotkey:
Run script on hotkey:


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


Deps: {{Pkg|xorg-xprop}}, {{Pkg|xdotool}}
Dependencies: {{Pkg|xorg-xprop}}, {{Pkg|xdotool}}
 
See also [[#Killing an application visually]].


=== Block TTY access ===
=== Block TTY access ===
{{Expansion|Why would you want to do this?}}


To block tty access when in an X add the following to [[#Configuration|xorg.conf]]:
To block tty access when in an X add the following to [[#Configuration|xorg.conf]]:
Line 448: Line 501:
EndSection
EndSection
}}
}}
This can be used to help restrict command line access on a system accessible to non-trusted users.


=== Prevent a user from killing X ===
=== Prevent a user from killing X ===


To prevent a user from killing when it is running add the following to [[#Configuration|xorg.conf]]:
To prevent a user from killing X when it is running add the following to [[#Configuration|xorg.conf]]:


{{bc|
{{bc|
Line 458: Line 513:
EndSection
EndSection
}}
}}
{{Note|The {{ic|Ctrl+Alt+Backspace}} shortcut is not directly what triggers killing the X server, but the {{ic|Terminate_Server}} action from the keyboard map. This is usually not set by default, see [[Xorg/Keyboard configuration#Terminating Xorg with Ctrl+Alt+Backspace]].}}
=== Killing an application visually ===
When an application is misbehaving or stuck, instead of using {{ic|kill}} or {{ic|killall}} from a terminal and having to find the process ID or name, {{Pkg|xorg-xkill}} allows to click on said application to close its connection to the X server. Many existing applications do indeed abort when their connection to the X server is closed, but some can choose to continue.


=== Rootless Xorg ===
=== Rootless Xorg ===


Xorg may run with standard user privileges instead of root (so-called "rootless" Xorg). This is a significant security improvement over running as root. Note that most display managers do not support rootless Xorg.
Xorg may run with standard user privileges instead of root (so-called "rootless" Xorg). This is a significant security improvement over running as root. Note that some popular [[display manager]]s do not support rootless Xorg (e.g. [https://github.com/canonical/lightdm/issues/18 LightDM] or [[XDM]]).


You can verify which user Xorg is running as with {{ic|ps -o user $(pgrep Xorg)}}.
You can verify which user Xorg is running as with {{ic|1=ps -o user= -C Xorg}}.


See also {{man|1|Xorg.wrap}}, {{man|8|systemd-logind}}, [[Systemd/User#Xorg as a systemd user service]], [https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights] and {{Bug|41257}}.  
See also {{man|1|Xorg.wrap}}, {{man|8|systemd-logind}}, [[Systemd/User#Xorg as a systemd user service]], [[Fedora:Changes/XorgWithoutRootRights]] and {{Bug|41257}}.


==== Using xinitrc ====
==== Using xinitrc ====
Line 473: Line 534:
* Run startx as a subprocess of the login shell; run {{ic|startx}} directly and do not use {{ic|exec startx}}.
* Run startx as a subprocess of the login shell; run {{ic|startx}} directly and do not use {{ic|exec startx}}.
* Ensure that Xorg uses virtual terminal for which permissions were set, i.e. passed by logind in {{ic|$XDG_VTNR}} via [[xinit#xserverrc|.xserverrc]].
* Ensure that Xorg uses virtual terminal for which permissions were set, i.e. passed by logind in {{ic|$XDG_VTNR}} via [[xinit#xserverrc|.xserverrc]].
* If using certain proprietary display drivers, [[kernel mode setting]] [https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/xorg-wrapper.c#n222 auto-detection] will fail. In such cases, you must set {{ic|1=needs_root_rights = no}} in {{ic|/etc/X11/Xwrapper.config}}.
* If using certain proprietary display drivers, [[kernel mode setting]] [https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/hw/xfree86/xorg-wrapper.c#L222 auto-detection] will fail. In such cases, you must set {{ic|1=needs_root_rights = no}} in {{ic|/etc/X11/Xwrapper.config}}.


==== Using GDM ====
==== Using GDM ====
Line 486: Line 547:


Alternatively, copy {{ic|/etc/X11/xinit/xserverrc}} to {{ic|~/.xserverrc}}, and append {{ic|-keeptty}}. See [https://bbs.archlinux.org/viewtopic.php?pid=1446402#p1446402].
Alternatively, copy {{ic|/etc/X11/xinit/xserverrc}} to {{ic|~/.xserverrc}}, and append {{ic|-keeptty}}. See [https://bbs.archlinux.org/viewtopic.php?pid=1446402#p1446402].
=== Xorg as Root ===
As explained above, there are circumstances in which rootless Xorg is defaulted to. If this is the case for your configuration, and you have a need to run Xorg as root, you can configure {{man|1|Xorg.wrap}} to require root:
{{Warning|Running Xorg as root poses security issues. See [[#Rootless Xorg]] for further discussion.}}
{{hc|1=/etc/X11/Xwrapper.config|2=
needs_root_rights = yes
}}


== Troubleshooting ==
== Troubleshooting ==
Line 498: Line 569:
[    40.623] (==) Log file: "/home/archuser/.local/share/xorg/Xorg.0.log", Time: Thu Aug 28 12:36:44 2014
[    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
[    40.704] (--) controlling tty is VT number 1, auto-enabling KeepTty
}}
{{Tip|To monitor the log with human-readable timestamps, {{man|1|tail}}'s output can be piped to {{man|1|ts}} (provided by the {{Pkg|moreutils}} package). This will give correct timestamps only for lines added to the log while the command is running. For example:
$ tail -f ~/.local/share/xorg/Xorg.0.log {{!}} ts
}}
}}


Line 510: Line 585:


* Check specific pages in [[:Category:Input devices]] if you have issues with keyboard, mouse, touchpad etc.
* 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.
* Search for common problems in [[AMDGPU]], [[Intel]] and [[NVIDIA]] articles.


=== Black screen, No protocol specified.., Resource temporarily unavailable for all or some users ===
=== 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.
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.
Line 522: Line 597:
  Option "OldDmaInit" "On"
  Option "OldDmaInit" "On"


to the Device section that references the video card in {{ic|xorg.conf}}.
to the {{ic|Device}} section that references the video card in {{ic|xorg.conf}}.


=== Frame-buffer mode problems ===
=== Frame-buffer mode problems ===


If X fails to start with the following log messages,
X fails to start with the following log messages:


{{bc|<nowiki>
{{bc|<nowiki>
Line 542: Line 617:
</nowiki>}}
</nowiki>}}


[[Uninstall]] the {{pkg|xf86-video-fbdev}} package.
To correct, [[uninstall]] the {{pkg|xf86-video-fbdev}} package.


=== Program requests "font '(null)'" ===
=== Program requests "font '(null)'" ===
Line 558: Line 633:
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.


* Change default target to rescue.target. See [[systemd#Change default target to boot into]].
* Change default target to {{ic|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#Format the partitions|installation guide]] about how to mount and chroot into the installed Arch Linux. Alternatively try to switch into another [[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. Follow the [[Installation guide#Format the partitions|installation guide]] about how to mount and chroot into the installed Arch Linux. Alternatively try to switch into another [[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.


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


* [[Disable]] the [[display manager]].
* [[Disable]] the [[display manager]].
* Disable the [[start X at login|automatic start of the X]].
* Disable the [[start X at login|automatic start of X]].
* Rename the {{ic|~/.xinitrc}} or comment out the {{ic|exec}} line in it.
* Rename the {{ic|~/.xinitrc}} or comment out the {{ic|exec}} line in it.


=== X clients started with "su" fail ===
=== X clients started with "su" fail ===


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


  session        optional        pam_xauth.so
  session        optional        pam_xauth.so
Line 577: Line 652:
=== X failed to start: Keyboard initialization failed ===
=== X failed to start: Keyboard initialization failed ===


If the filesystem (specifically {{ic|/tmp}}) is full, {{ic|startx}} will fail. {{ic|/var/log/Xorg.0.log}} will end with:
If the filesystem (specifically {{ic|/tmp}}) is full, {{ic|startx}} will fail. The log file will contain:


{{bc|<nowiki>
{{bc|
(EE) Error compiling keymap (server-0)
(EE) Error compiling keymap (server-0)
(EE) XKB: Could not compile keymap
(EE) XKB: Could not compile keymap
Line 589: Line 664:
Fatal server error:
Fatal server error:
Failed to activate core devices.
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
</nowiki>}}


Make some free space on the relevant filesystem and X will start.
Make some free space on the relevant filesystem and X will start.


=== A green screen whenever trying to watch a video===
=== A green screen whenever trying to watch a video ===


Your color depth is set wrong. It may need to be 24 instead of 16, for example.
Your color depth is set wrong. It may need to be 24 instead of 16, for example.
Line 603: Line 675:
=== SocketCreateListener error ===
=== 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}}).
If X terminates with error message {{ic|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}}).


=== Invalid MIT-MAGIC-COOKIE-1 key when trying to run a program as root ===
=== Invalid MIT-MAGIC-COOKIE-1 key when trying to run a program as root ===
Line 626: Line 698:


* [https://magcius.github.io/xplain/article/ Xplain] - In-depth explanation of the X Window System
* [https://magcius.github.io/xplain/article/ Xplain] - In-depth explanation of the X Window System
* {{man|1|Xorg}} - Xorg's Manual Page
* {{man|1|Xorg}}
* [https://wiki.gentoo.org/wiki/Xorg/Guide/en#Configuration Gentoo/Xorg#Configuration] - Gentoo Wiki's Xorg Configuration page
* [https://developer.ibm.com/tutorials/l-lpic1-106-1/ Prepare for LPIC-1 exam 2 - topic 106.1: X11] - briefly covers architecture, [[#Configuration]], [[desktop environments]], remote usage, [[Wayland]].
* {{man|5|xorg.conf}}
* [[Gentoo:Xorg/Guide#Configuration]]

Latest revision as of 19:35, 14 January 2024

From https://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 (commonly referred to as simply X) 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.

For the alternative and successor, see Wayland.

Installation

Xorg can be installed with the xorg-server package.

Additionally, some packages from the xorg-apps group are necessary for certain configuration tasks. They are pointed out in the relevant sections.

Finally, an xorg group is also available, which includes Xorg server packages, packages from the xorg-apps group and fonts.

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 the graphics card (the Subsystem output shows the specific model):

$ lspci -v | grep -A1 -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), which does not include any 2D or 3D acceleration.
  • 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 modesetting(4)).

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:

This article or section needs expansion.

Reason: How does nvidia-open fit into here? Does it use the same OpenGL/Vulkan drivers provided in nvidia-utils? (Discuss in Talk:Xorg)
Brand Type Documentation Driver OpenGL OpenGL (multilib) Vulkan Vulkan (multilib)
AMD (ex-ATI) Open source AMDGPU xf86-video-amdgpu mesa lib32-mesa vulkan-radeon / amdvlk4 lib32-vulkan-radeon / lib32-amdvlk4
ATI xf86-video-ati None
Proprietary AMDGPU PRO xf86-video-amdgpu amdgpu-pro-oglpAUR lib32-amdgpu-pro-oglpAUR vulkan-amdgpu-proAUR lib32-vulkan-amdgpu-proAUR
Intel Open source Intel graphics xf86-video-intel2 mesa or mesa-amber3 lib32-mesa vulkan-intel lib32-vulkan-intel
NVIDIA Open source Nouveau1 xf86-video-nouveau mesa lib32-mesa None5
Proprietary NVIDIA1 nvidia nvidia-utils lib32-nvidia-utils nvidia-utils lib32-nvidia-utils
nvidia-470xx-dkmsAUR nvidia-470xx-utilsAUR lib32-nvidia-470xx-utilsAUR nvidia-470xx-utilsAUR lib32-nvidia-470xx-utilsAUR
nvidia-390xx-dkmsAUR nvidia-390xx-utilsAUR lib32-nvidia-390xx-utilsAUR nvidia-390xx-utilsAUR lib32-nvidia-390xx-utilsAUR
  1. For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see NVIDIA Optimus.
  2. For Intel graphics on 4th generation and above, see Intel graphics#Installation for available drivers.
  3. Classic OpenGL (non-Gallium3D) drivers for older hardware (Mesa 22.0 and higher have dropped support for i915 classic driver)
  4. vulkan-radeon / lib32-vulkan-radeon is recommended over amdvlk / lib32-amdvlk (see AMDGPU#Installation).
  5. NVK, the experimental open source Vulkan driver for Nvidia GPUs, is expected to be included in mesa 23.3

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. The exceptions to this rule are recent GPUs (especially NVIDIA GPUs) not supported by open source drivers.

AMD

For a translation of model names (e.g. Radeon RX 6800) to GPU architectures (e.g. RDNA 2), see Wikipedia:List of AMD graphics processing units#Features overview.

GPU architecture Open-source driver Proprietary driver
RDNA and later AMDGPU AMDGPU PRO
GCN 3 and later
GCN 1&2 AMDGPU1 / ATI not available
TeraScale
and older
ATI not available
  1. Experimental.

Running

The Xorg(1) command is usually not run directly. Instead, the X server is started with either a display manager or xinit.

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

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 in xorg.conf(5), 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. Note that on conflicting configuration, the file read last will be processed. For this reason, the most generic configuration files should be ordered first by name. The configuration entries in the xorg.conf file are processed at the end.

For option examples to set, see Fedora:Input device configuration#xorg.conf.d.

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 AMDGPU PRO, 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 X server defaults to the libinput driver (xf86-input-libinput), but xf86-input-evdev and related drivers are available as alternative.[1]

Udev, which is provided as a systemd dependency, will detect hardware and both drivers will act as hotplugging input driver for almost all devices, as defined in the default configuration files 10-quirks.conf and 40-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 " 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 Fedora:Input device configuration for more examples.

Input identification

See Keyboard input#Identifying keycodes in Xorg.

Mouse acceleration

See Mouse acceleration.

Extra mouse buttons

See Mouse buttons.

Touchpad

See libinput or Synaptics.

Touchscreen

See Touchscreen.

Keyboard settings

See Keyboard configuration in Xorg.

Monitor settings

Manual configuration

Note:
  • Newer versions of Xorg are auto-configuring, so manual configuration should not be needed.
  • If Xorg is unable to detect any monitor or to avoid auto-configuring, a configuration file can be used. 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.

For a headless configuration, the xf86-video-dummy driver is necessary; install it and create a configuration file, such as the following:

/etc/X11/xorg.conf.d/10-headless.conf
Section "Monitor"
        Identifier "dummy_monitor"
        HorizSync 28.0-80.0
        VertRefresh 48.0-75.0
        Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection

Section "Device"
        Identifier "dummy_card"
        VideoRam 256000
        Driver "dummy"
EndSection

Section "Screen"
        Identifier "dummy_screen"
        Device "dummy_card"
        Monitor "dummy_monitor"
        SubSection "Display"
        EndSubSection
EndSection

Multiple monitors

See main article Multihead for general information.

More than one graphics card

You must define the correct driver to use and put the bus ID of your graphic cards (in decimal notation).

Section "Device"
    Identifier             "Screen0"
    Driver                 "intel"
    BusID                  "PCI:0:2:0"
EndSection

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

To get your bus IDs (in hexadecimal):

$ lspci | grep -e VGA -e 3D
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)

The bus IDs here are 0:2:0 and 1:0:0.

Display size and DPI

By default, Xorg always sets DPI to 96 since 2009 (see [2]). A change was made with version 21.1 to provide proper DPI auto-detection, but reverted (see FS#72661).

The DPI of the X server can be set with the -dpi command line option.

Having the correct DPI is helpful 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 see if your display size and DPI are correct:

$ xdpyinfo | grep -B2 resolution

Check that the dimensions match your display size.

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 (adjust identifier to your xrandr output):

Section "Monitor"
    Identifier             "DVI-D-0"
    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 configuration file. For example (/etc/X11/xorg.conf.d/90-monitor.conf):

Section "Monitor"
    Identifier             "<default monitor>"
    DisplaySize            286 179    # In millimeters
EndSection
Note: If you are using the proprietary NVIDIA driver, you may have to put Option "UseEdidDpi" "FALSE" under Device or Screen section to make it take effect.

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 rare 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 is recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUIs that use bitmaps. Reducing it below 96 dpi may not reduce the size of the GUIs graphical elements, 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.

To make it permanent, see Autostarting#On Xorg startup.

Proprietary NVIDIA driver

You can manually set the DPI by adding the option under the Device or Screen section:

Option              "DPI" "96 x 96"
Manual DPI Setting Caveat

GTK very often overrides the server's DPI via the optional Xresource Xft.dpi. To find out whether this is happening to you, check with:

$ xrdb -query | grep dpi

With GTK library versions since 3.16, when this variable is not otherwise explicitly set, GTK sets it to 96. To have GTK apps obey the server DPI you may need to explicitly set Xft.dpi to the same value as the server. The Xft.dpi resource is the method by which some desktop environments optionally force DPI to a particular value in personal settings. Among these are KDE and TDE.

Display Power Management

DPMS 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. For more information, see Wikipedia: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

  • Picom — Lightweight compositor with shadowing, advanced blurring and fading. Forked from Compton.
https://github.com/yshui/picom || picom
  • Xcompmgr — Composite window-effects manager.
https://gitlab.freedesktop.org/xorg/app/xcompmgr/ || xcompmgr
  • Gamescope — The micro-compositor from Valve, with gaming-oriented features such as FSR upscaling. Forked from steamos-compositor.
https://github.com/ValveSoftware/gamescope || gamescope
  • steamos-compositor-plus — Valve's compositor, with some added tweaks and fixes.
https://github.com/chimeraos/steamos-compositor-plus || steamos-compositor-plusAUR

Tips and tricks

Automation

This section lists utilities for automating keyboard / mouse input and window operations (like moving, resizing or raising).

Tool Package Manual Keysym
input
Window
operations
Note
xautomation xautomation xte(1) Yes No Also contains screen scraping tools. Cannot simulate F13 and more.
xdo xdo xdo(1) No Yes Small X utility to perform elementary actions on windows.
xdotool xdotool xdotool(1) Yes Yes Very buggy and not in active development, e.g: has broken CLI parsing.[3][4]
xvkbd xvkbdAUR xvkbd(1) Yes No Virtual keyboard for Xorg, also has the -text option for sending characters.
AutoKey autokey-qtAUR autokey-gtkAUR documentation Yes Yes Higher-level, powerful macro and scripting utility, with both Qt and Gtk front-ends.

See also Clipboard#Tools and an overview of X automation tools.

Nested X session

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.

A more modern way of doing a nested X session is with Xephyr.

Starting an application without a window manager

See xinit#Starting applications without a window manager.

Starting GUI programs remotely

See main article: OpenSSH#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.

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"

Persistently disable input source

You can disable a particular input source using a configuration snippet:

/etc/X11/xorg.conf.d/30-disable-device.conf
Section "InputClass"
       Identifier   "disable-device"
       Driver       "driver_name"
       MatchProduct "device_name"
       Option       "Ignore" "True"
EndSection

device is an arbitrary name, and driver_name is the name of the input driver, e.g. libinput. device_name is what is actually used to match the proper device. For alternate methods of targeting the correct device, such as libinput's MatchIsTouchscreen, consult your input driver's documentation. Though this example uses libinput, this is a driver-agnostic method which simply prevents the device from being propagated to the driver.

Killing application with hotkey

Run script on hotkey:

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

Dependencies: xorg-xprop, xdotool

See also #Killing an application visually.

Block TTY access

To block tty access when in an X add the following to xorg.conf:

Section "ServerFlags"
    Option "DontVTSwitch" "True"
EndSection

This can be used to help restrict command line access on a system accessible to non-trusted users.

Prevent a user from killing X

To prevent a user from killing X when it is running add the following to xorg.conf:

Section "ServerFlags"
    Option "DontZap"      "True"
EndSection
Note: The Ctrl+Alt+Backspace shortcut is not directly what triggers killing the X server, but the Terminate_Server action from the keyboard map. This is usually not set by default, see Xorg/Keyboard configuration#Terminating Xorg with Ctrl+Alt+Backspace.

Killing an application visually

When an application is misbehaving or stuck, instead of using kill or killall from a terminal and having to find the process ID or name, xorg-xkill allows to click on said application to close its connection to the X server. Many existing applications do indeed abort when their connection to the X server is closed, but some can choose to continue.

Rootless Xorg

Xorg may run with standard user privileges instead of root (so-called "rootless" Xorg). This is a significant security improvement over running as root. Note that some popular display managers do not support rootless Xorg (e.g. LightDM or XDM).

You can verify which user Xorg is running as with ps -o user= -C Xorg.

See also Xorg.wrap(1), systemd-logind(8), Systemd/User#Xorg as a systemd user service, Fedora:Changes/XorgWithoutRootRights and FS#41257.

Using xinitrc

To configure rootless Xorg using xinitrc:

  • Run startx as a subprocess of the login shell; run startx directly and do not use exec startx.
  • Ensure that Xorg uses virtual terminal for which permissions were set, i.e. passed by logind in $XDG_VTNR via .xserverrc.
  • If using certain proprietary display drivers, kernel mode setting auto-detection will fail. In such cases, you must set needs_root_rights = no in /etc/X11/Xwrapper.config.

Using GDM

GDM will run Xorg without root privileges by default when kernel mode setting is used.

Session log redirection

When Xorg is run in rootless mode, Xorg logs are saved to ~/.local/share/xorg/Xorg.log. However, the stdout and stderr output from the Xorg session is not redirected to this log. To re-enable redirection, start Xorg with the -keeptty flag and redirect the stdout and stderr output to a file:

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

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

Xorg as Root

As explained above, there are circumstances in which rootless Xorg is defaulted to. If this is the case for your configuration, and you have a need to run Xorg as root, you can configure Xorg.wrap(1) to require root:

Warning: Running Xorg as root poses security issues. See #Rootless Xorg for further discussion.
/etc/X11/Xwrapper.config
needs_root_rights = yes

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. [6]

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
Tip: To monitor the log with human-readable timestamps, tail(1)'s output can be piped to ts(1) (provided by the moreutils package). This will give correct timestamps only for lines added to the log while the command is running. For example:
$ tail -f ~/.local/share/xorg/Xorg.0.log | ts
  • 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+F6), 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 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.

DRI with Matrox cards stopped working

If you use a Matrox card and DRI stopped 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

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

To correct, uninstall the xf86-video-fbdev package.

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 xdpyinfo from xorg-xdpyinfo, like 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 and /etc/pam.d/su-l. pam_xauth will then properly set environment variables and handle xauth keys.

X failed to start: Keyboard initialization failed

If the filesystem (specifically /tmp) is full, startx will fail. The log file will contain:

(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.
...

Make some free space on the relevant filesystem and X will start.

A green screen whenever trying 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).

Invalid MIT-MAGIC-COOKIE-1 key when trying to run a program as root

That error means that only the current user has access to the X server. The solution is to give access to root:

$ xhost +si:localuser:root

That line can also be used to give access to X to a different user than root.

Xorg-server Fatal server error: (EE) AddScreen/ScreenInit

If the Xorg server is not working randomly and in the Xorg log you see:

systemd-logind: failed to take device /dev/dri/card0: Operation not permitted
...
AddScreen/ScreenInit failed for driver 0

Then, this problem may be caused by systemd issue 13943. Set up early KMS start.

See also