New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libinput: ensure that we only apply touchpad options to touchpads #90635
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with libinput enabled on:
- computer with only mouse
- laptop with touchpad
- laptop with touchpad and mouse
Did the right thing in all cases, and the "Failed to set scroll to twofinger" errors are now gone. Nice!
Merging based on the review of @pwetzel. Thank you. |
This breaks the application of the libinput configuration for touchpads (at least for me). It doesn't break libinput since that is handled separately by another configuration file I believe. So the touchpad would still work but any custom options wouldn't be applied (basically rendering the module useless). I believe this was a configuration error on the part of the user. The Anyway, the proper way of identifying only touchpads would probably be Source: My libinput settings weren't applied and thus broke my tap-to-click, button layout, etc. |
I screwed up. I thought I saw good news in the X log and scrolling worked and I didn't push it any further. Sorry. I confirm that this breaks touchpad function like tap-to-click. The approach in the PR seems like it should have worked. MatchTag is described here[1], and my laptop has a log entry like this: I just tried lowercase @eadwu, I think you're suggesting there's a better way to go about solving this problem? It seems like good UX to have the default libinput snippet (very much targeted at trackpads) only apply to trackpads. This was obviously the wrong way to do it, but an implementation with [1] https://fedoraproject.org/wiki/Input_device_configuration#InputClasses |
If it only applies to trackpads then it wouldn't be generic enough for libinput (and wouldn't be changeable), which covers all input devices. This may have also introduced some unintended breakages since the original mapped to all input devices and it doesn't seem like Xorg just crashes from an invalid configuration from libinput. But yeah, I think this should've just been settled through an override, which should be possible (I'm pretty sure) with a config file like For the particular issue of the custom |
It's not clear to me whether the default libinput options are intended to be for general libinput or for trackpads. The configuration structure would seem to suggest it's for everything, but the actual InputClass section seems to be trackpad-specific. This means that the configuration at the moment will always produce an error if you try to configure something other than a trackpad to use libinput. Unless we have a clear goal for this config to be trackpad-specific or not, it's hard to say what should go here. Using ordering to override the InputClass might make sense (but in that case shouldn't custom InputClasses always go after the generic stuff?) but it's still not good practice to set nonsensical options for non-trackpads — if this section is meant to be generic, we should probably remove all trackpad-specific stuff from it and add a new trackpad-specific InputClass with its own config options. |
Motivation for this change
It seems that the default
libinputConfiguration
InputClass
section generated by the libinput module is intended for touchpads, and include touchpad-specific options such asTappingDragLock
and (by default)ScrollMethod twofinger
. These are fine when applied to touchpads, but if we wish to set them on something else they may fail, causing the option to be ignored entirely. For example, I have a Kensington Expert Mouse, one of whose four buttons I like to dedicate to being a scroll button, to allow me to use the trackball for scrolling rather than the scrolling ring, so I have an entry inservices.xserver.inputClassSections
like this:Unfortunately, when Xorg loads the generated configuration file, it will first attempt to apply the
libinputConfiguration
section to my trackball, which states amongst other things thatOption "ScrollMethod" "twofinger"
, generating an error like this:Then, my own
Option "ScrollMethod" "button"
is ignored.This PR adds a condition to the
libinputConfiguration
block that causes it to only match trackpads (as identified and tagged by udev).Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)