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
nixos/libinput: separate settings by mouse/touchpad #108909
nixos/libinput: separate settings by mouse/touchpad #108909
Conversation
Rebased and tried to reduce the diff as maximum as possible to make the review easier. |
/marvin opt-in |
Hi! I'm an experimental bot. My goal is to guide this PR through its stages, hopefully ending with a merge. You can read up on the usage here. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
${cfg.additionalOptions} | ||
EndSection | ||
''; | ||
services.xserver.inputClassSections = [ |
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.
As a side effect of using inputClassSections
instead of config
here, this now works as it should:
{
xserver = {
enable = true;
libinput = {
enable = true;
mouse = {
naturalScrolling = true;
};
};
};
inputClassSections = [
''
Identifier "natural scrolling"
MatchIsPointer "on"
Option "NaturalScrolling" "on"
''
];
}
You will have Natural Scrolling in a mouse in this case.
And while this may be strange, it is important to cover the cases like PR #90635 (that was reverted later). So even if we set something by default in mouse/touchpad, the user can always overwrite (this is isn't true nowadays since you can't overwrite a config
with inputClassSections
).
|
||
mkConfigForDevice = deviceType: { |
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.
Not every option makes sense for mouse and touchpad here, so probably we will need some mkIf deviceType == "touchpad"
and mkIf deviceType == "mouse"
. But I think this can be fixed in another PR since there isn't any clear documentation if option X is never applied for Y device.
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.
I think I'd prefer adding the type-specific options not here but where we use the function, like touchpad = mkConfigForDevice "touchpad" // { tapToClick = mkOption …; };
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.
Yeah, this makes sense. Once this PR is merged I will look at it.
Hi @thiagokokada I'm actually really interested in your PR, but my brain is like 🧻 rn so I don't think I can make a good review. Maybe @lheckemann? |
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.
I think this needs a release notes entry, since (correct me if I'm wrong) settings that would previously apply to mice no longer will with this change. Overall LGTM.
|
||
mkConfigForDevice = deviceType: { |
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.
I think I'd prefer adding the type-specific options not here but where we use the function, like touchpad = mkConfigForDevice "touchpad" // { tapToClick = mkOption …; };
This commits deprecates `services.xserver.libinput` for multiple settings, one for each kind of device: - `services.xserver.libinput.mouse` - `services.xserver.libinput.touchpad` Looking at `man 4 libinput`, they basically have the same options so I simply replicated them, even if some options doesn't make sense for mouse (`tapping` for example). With this commit this is now possible: ```nix { services.xserver.libinput = { enable = true; mouse = { accelProfile = "flat"; }; touchpad = { naturalScrolling = true; }; }; } ``` And you will have a mouse with no natural scrolling but with accel profile flat, while touchpad will have natural scrolling but accel profile adaptative (default). It is possible to support more device types (tablets/keyboards/touchscreens), but at least looking at the libinput manual for those devices it doesn't seem that it has any configuration options for them. They can still be configured using `services.xserver.inputClassSections` though, and this will work now since there is no rule by default that matches them. Closes issue #75007, while also making configuration of mouses and touchpads using Nix attrs possible like said in PR #73785.
Documentation done (needed a rebase to avoid conflicts). @lheckemann Can you please review again? |
@lheckemann Sorry to bother you, but can you review this PR again? |
Reminder: Please review! This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR Note: This feature is currently broken. The bot will not actually change the status. If you see this message multiple times, please request a status change manually. |
Do we want to provide I updated my nixpkgs checkout, and then got the following error message:
I mean, I figured out how to migrate, but usually we do this where feasible. |
Thanks! |
@flokli Wait, yeah, I did them: https://github.com/NixOS/nixpkgs/pull/108909/files#diff-27164ac6e7f2a68c13050fa6e230c23671056d1357c534e79bb1d2969110bddeR214-R231 Well, let me investigate why they're not working. I have some tests in my #110350 branch, so this will make it easier. |
Whoops, found the issue. Only tappingDragLock was missing. Ok, opening the PR ASAP. |
Fixed it here: #110403 |
The issue was solved by NixOS/nixpkgs/pull/108909.
This PR deprecates
services.xserver.libinput
for multiple settings, one for each kind of device:services.xserver.libinput.mouse
services.xserver.libinput.touchpad
Looking at
man 4 libinput
, they basically have the same options so I simply replicated them, even if some options doesn't make sense for mouse (tapping
for example).With this commit this is now possible:
And you will have a mouse with no natural scrolling but with accel profile flat, while touchpad will have natural scrolling but accel profile adaptative (default).
It is possible to support more device types (tablets/keyboards/touchscreens), but at least looking at the
libinput manual for those devices it doesn't seem that it has any configuration options for them. They can still be configured using
services.xserver.inputClassSections
though, and this will work now since there is no rule by default that matches them.Closes issue #75007, while also making configuration of mouses and touchpads using Nix attrs possible like said in PR #73785.
Alternative for #107676. This is a more elegant solution, but the other PR is much simpler, so I think both approaches are valid. So I will keep both, and closes the other one after one is merged.
Motivation for this change
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)