Xorg: Difference between revisions

From NixOS Wiki
imported>Makefu
m add heading
Undo revision 17656 by Levitsky (talk)
Tag: Undo
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
== Disabling mouse acceleration ==
== HiDPI ==
To disable mouse acceleration for a touchpad, it's as simple as


<pre>
HiDPI (High Dots Per Inch) displays, also known by Apple's "Retina Display" marketing name, are screens with a high resolution in a relatively small format. They are mostly found in high-end laptops and monitors.
  services.xserver.libinput.enable = true;
  services.xserver.libinput.accelProfile = "flat";
</pre>


But to disable it for a mouse, it's a bit more wordy -
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">
   services.xserver.libinput.enable = true;
  # bigger tty fonts
   services.xserver.config = ''
  console.font =
     Section "InputClass"
    "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
      Identifier "mouse accel"
   services.xserver.dpi = 180;
      Driver "libinput"
  environment.variables = {
      MatchIsPointer "on"
    ## Used by GTK 3
       Option "AccelProfile" "flat"
    # `GDK_SCALE` is limited to integer values
       Option "AccelSpeed" "0"
    GDK_SCALE = "2";
    EndSection
    # Inverse of GDK_SCALE
   '';
    GDK_DPI_SCALE = "0.5";
</pre>
 
    # Used by Qt 5
    QT_AUTO_SCREEN_SCALE_FACTOR = "1";
 
    _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2";
  };
  # 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>:
 
<syntaxhighlight>
Xft.dpi: 180
</syntaxhighlight>
 
== Disabling touchpad and mouse accelerations ==
To disable touchpad and mouse accelerations just add the following lines to your <code>configuration.nix</code>
 
<syntaxhighlight lang="nix">
  services.xserver = {
    enable = true;
 
    ...
 
    libinput = {
       enable = true;
 
      # disabling mouse acceleration
      mouse = {
        accelProfile = "flat";
      };
 
      # 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 ==
 
* [[Nvidia]]
* [[AMD GPU]]
* [[Intel Graphics]]
 
[[Category:Video]]

Latest revision as of 10:08, 27 September 2024

HiDPI

HiDPI (High Dots Per Inch) displays, also known by Apple's "Retina Display" marketing name, are screens with a high resolution in a relatively small format. They are mostly found in high-end laptops and monitors.

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:

  # bigger tty fonts
  console.font =
    "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz";
  services.xserver.dpi = 180;
  environment.variables = {
    ## Used by GTK 3
    # `GDK_SCALE` is limited to integer values
    GDK_SCALE = "2";
    # Inverse of GDK_SCALE
    GDK_DPI_SCALE = "0.5";

    # Used by Qt 5
    QT_AUTO_SCREEN_SCALE_FACTOR = "1";

    _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2";
  };
  # Expose variables to graphical systemd user services
  services.xserver.displayManager.importedVariables = [
    "GDK_SCALE"
    "GDK_DPI_SCALE"
    "QT_AUTO_SCREEN_SCALE_FACTOR"
  ];

To enable HiDPI scaling for Qt 6 applications, add the following to .Xresources:

Xft.dpi: 180

Disabling touchpad and mouse accelerations

To disable touchpad and mouse accelerations just add the following lines to your configuration.nix

  services.xserver = {
    enable = true;

    ...

    libinput = {
      enable = true;

      # disabling mouse acceleration
      mouse = {
        accelProfile = "flat";
      };

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

    ...

  };

To get more information see man configuration.nix.

Exclude packages

Some packages like xterm are included when enabling Xorg. To exclude packages, edit the configuration.nix as the example, but be sure to have another terminal enabled in your build before doing this.

services.xserver.excludePackages = with pkgs; [
  xterm
];

See also