Xorg

From NixOS Wiki
Revision as of 06:05, 10 January 2022 by Equirosa (talk | contribs) (Add syntax highlighting to code snippets)
Jump to: navigation, search

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 = {
    GDK_SCALE = "2";
    GDK_DPI_SCALE = "0.5";
    _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2";
  };

In NixOS unstable (but not in NixOS 20.03) there is also a dedicated HiDPI module:

{
  hardware.video.hidpi.enable = true;
}

This option will be included by default when using nixos-config-generate and it detects a screen larger than fullhd. This will only set linux console fonts xserver dpi settings and environment variables still needs to be applied manually.

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.

See also