Best place to configure xinput commands?

Hello,

I recently started using a new laptop that has a touchpad with poor defaults on Linux.

Most annoying is the scroll speed (too slow). I can’t find any libinput options to fix it, but I’ve been able to reliably fix the scroll speed by manually running an xinput command each boot.

Assuming there isn’t a better way to go about doing what I’m doing, where would be the best place in my NixOS configuration to put commands such as xinput that should be run each boot?

Thanks!

3 Likes

I think you can use:
services.xserver.displayManager.sessionCommands

or if you have home-manager:
xsession.initExtra

2 Likes

This should be the preferred method (ripped off my configuration)

{ ... }:

{
  services.xserver.libinput = {
    clickMethod = "buttonareas";
    disableWhileTyping = true;
    enable = true;
    middleEmulation = true;
    tapping = true;

    additionalOptions = ''
      Option "PalmDetection" "on"
      Option "TappingButtonMap" "lmr"
    '';
  };
}
3 Likes

@eadwu Hmm, I wish I could do that, but xinput seems to expose a lot more options than libinput directly (at least via X11 config files). For example, in xinput, the parameter I’m looking for is called Scroll Distance. I can’t find that in the libinput docs.

1 Like

services.xserver.displayManager.sessionCommands works for me on startup but settings are gone (and not restored) after waking up from sleep

1 Like