Xorg: Difference between revisions

imported>Mic92
link to graphic cards
Malix (talk | contribs)
m See also: feat: reference link to wayland
 
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[https://en.wikipedia.org/wiki/X.Org_Server Xorg] is the implementation of the [https://en.wikipedia.org/wiki/X_Window_System X Window System]. It acts as the bridge between your system's hardware and the graphical user environment enabling a variety of [[:Category:Desktop environment|desktop environments]] and [[:Category:Window managers|window managers]].
= Enabling =
On NixOS, users can enable and configure Xorg through the {{nixos:option|services.xserver}} module in their system configuration.
See {{NixOS Manual|name=NixOS Manual: Chapter - X Window Syestem|anchor=#sec-x11}} for information on using X11 with NixOS.
= Tips and tricks =
== HiDPI ==
== HiDPI ==


Line 5: Line 15:
Not all software behaves well in high-resolution mode yet. Here are listed most common tweaks which make work on a HiDPI screen more pleasant:
Not all software behaves well in high-resolution mode yet. Here are listed most common tweaks which make work on a HiDPI screen more pleasant:


<pre>
<syntaxhighlight lang="nix">
   # bigger tty fonts
   # bigger tty fonts
   console.font =
   console.font =
Line 11: Line 21:
   services.xserver.dpi = 180;
   services.xserver.dpi = 180;
   environment.variables = {
   environment.variables = {
    ## Used by GTK 3
    # `GDK_SCALE` is limited to integer values
     GDK_SCALE = "2";
     GDK_SCALE = "2";
    # Inverse of GDK_SCALE
     GDK_DPI_SCALE = "0.5";
     GDK_DPI_SCALE = "0.5";
    # Used by Qt 5
    QT_AUTO_SCREEN_SCALE_FACTOR = "1";
     _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2";
     _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2";
   };
   };
</pre>
  # Expose variables to graphical systemd user services
  services.xserver.displayManager.importedVariables = [
    "GDK_SCALE"
    "GDK_DPI_SCALE"
    "QT_AUTO_SCREEN_SCALE_FACTOR"
  ];
</syntaxhighlight>
 
To enable HiDPI scaling for Qt 6 applications, add the following to <code>.Xresources</code>:


In NixOS unstable (but not in NixOS 20.03) there is also a dedicated [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/hardware/video/hidpi.nix HiDPI module]:
<syntaxhighlight>
Xft.dpi: 180
</syntaxhighlight>


<pre>
== Disabling touchpad and mouse accelerations ==
{
  hardware.video.hidpi.enable = true;
}
</pre>


This option will be included by default when using <code>nixos-config-generate</code> and it detects a screen larger than
To disable touchpad and mouse accelerations just add the following lines to your <code>configuration.nix</code>
fullhd. This will only set linux console fonts xserver dpi settings and environment variables still needs to be applied manually.


== Disabling mouse acceleration ==
<syntaxhighlight lang="nix">
To disable mouse acceleration for a touchpad, it's as simple as
  services.xserver = {
    enable = true;


<pre>
    ...
  services.xserver.libinput.enable = true;
  services.xserver.libinput.accelProfile = "flat";
</pre>


But to disable it for a mouse, it's a bit more wordy -
    libinput = {
      enable = true;


<pre>
       # disabling mouse acceleration
  services.xserver.libinput.enable = true;
       mouse = {
  services.xserver.config = ''
        accelProfile = "flat";
    Section "InputClass"
       };
       Identifier "mouse accel"
       Driver "libinput"
      MatchIsPointer "on"
      Option "AccelProfile" "flat"
       Option "AccelSpeed" "0"
    EndSection
  '';
</pre>


== See also ==
      # disabling touchpad acceleration
      touchpad = {
        accelProfile = "flat";
      };
    };


    ...
  };
</syntaxhighlight>
To get more information see <code>man configuration.nix</code>.
== Exclude packages ==
Some packages like xterm are included when enabling Xorg. To exclude packages, edit the <code>configuration.nix</code> as the example, but be sure to have another terminal enabled in your build before doing this.
<syntaxhighlight lang="nix">
services.xserver.excludePackages = with pkgs; [
  xterm
];
</syntaxhighlight>
= See also =
* [[Wayland]]
* [[Nvidia]]
* [[Nvidia]]
* [[Amd Gpu]]
* [[AMD GPU]]
* [[Intel Graphics]]
* [[Intel Graphics]]
* [[:Category:Desktop environment]]
* [[:Category:Window managers]]
[[Category:Video]]