Open rytswd opened 2 months ago
I am using hyprland and the hyprland.conf's
:
input {
...
touchpad {
...
disable_while_typing = true
}
Works without setting any other settings in the system. Not sure how specifically hyprland interacts with libinput to make this setting work and why niri is different. Might be worth trying out in a dev vm.
One difference is that I am using a user service as opposed to HM one (config link)
Thanks for the input @VTimofeenko -- I actually tried to do the same with Hyprland, but to no avail. The behaviour is the same between niri and Hyprland -- when I have xremap running, dwt setting gets ignored.
I appreciate the reference to your setup, I'll check more into that, and will report if I find anything 🙏
Can you try the system mode with niri but without application specifics? Something like this check's config.
So I tried something like below using nixosModule
services.xremap = {
withWlroots = true;
userName = "ryota";
serviceMode = "user";
watch = true;
deviceNames = [
"Asus Keyboard"
# "ASUF1208:00 2808:0218 Touchpad"
];
yamlConfig = (builtins.readFile ./tmp-xremap.yaml);
};
This is still causing the same behaviour as home-manager setup, and I could confirm that's also the case with serviceMode = "system";
.
One thing I could confirm is how the event ID gets updated when xremap is active.
With xremap running
$ libinput debug-events
event7 - ASUF1208:00 2808:0218 Touchpad: kernel bug: missing right button, assuming it is a clickpad.
-event3 DEVICE_ADDED Video Bus seat0 default group1 cap:k
-event4 DEVICE_ADDED Video Bus seat0 default group1 cap:k
-event0 DEVICE_ADDED Power Button seat0 default group2 cap:k
-event2 DEVICE_ADDED Lid Switch seat0 default group3 cap:S
-event1 DEVICE_ADDED Sleep Button seat0 default group4 cap:k
-event5 DEVICE_ADDED Yubico YubiKey OTP+FIDO+CCID seat0 default group5 cap:k
-event11 DEVICE_ADDED Asus Keyboard seat0 default group6 cap:kp left scroll-nat scroll-button
-event6 DEVICE_ADDED ASUF1208:00 2808:0218 Mouse seat0 default group7 cap:p left scroll-nat scroll-button
-event7 DEVICE_ADDED ASUF1208:00 2808:0218 Touchpad seat0 default group7 cap:pg size 125x76mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event12 DEVICE_ADDED xremap seat0 default group8 cap:kp left scroll-nat scroll-button
event12 KEYBOARD_KEY +0.000s *** (-1) pressed
a event12 KEYBOARD_KEY +0.152s *** (-1) released
Without xremap
$ libinput debug-events
event7 - ASUF1208:00 2808:0218 Touchpad: kernel bug: missing right button, assuming it is a clickpad.
-event3 DEVICE_ADDED Video Bus seat0 default group1 cap:k
-event4 DEVICE_ADDED Video Bus seat0 default group1 cap:k
-event0 DEVICE_ADDED Power Button seat0 default group2 cap:k
-event2 DEVICE_ADDED Lid Switch seat0 default group3 cap:S
-event1 DEVICE_ADDED Sleep Button
-event5 DEVICE_ADDED Yubico YubiKey OTP+FIDO+CCID seat0 default group5 cap:k
-event11 DEVICE_ADDED Asus Keyboard seat0 default group6 cap:kp left scroll-nat scroll-button
-event6 DEVICE_ADDED ASUF1208:00 2808:0218 Mouse seat0 default group7 cap:p left scroll-nat scroll-button
-event7 DEVICE_ADDED ASUF1208:00 2808:0218 Touchpad seat0 default group7 cap:pg size 125x76mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event11 KEYBOARD_KEY +0.000s *** (-1) pressed
a event11 KEYBOARD_KEY +0.152s *** (-1) released
For my case, event7 does have dwt-on
, and seems to work correctly -- as in, without xremap, I get no event coming through with libinput debug-events
when I'm typing. I'm assuming the translation from event11 (Asus Keyboard
) to event12 (xremap
) is affecting the dwt settings. Would you be able to check if you see a similar translation with your config?
Here's my outputs (hyprland, service running as my user from NixOS module).
I pressed "a" which is not remapped and "caps lock" which is rebound to "escape".
libinput debug-events
-event0 DEVICE_ADDED Video Bus seat0 default group1 cap:k
-event2 DEVICE_ADDED Lid Switch seat0 default group2 cap:S
-event3 DEVICE_ADDED Power Button seat0 default group3 cap:k
-event4 DEVICE_ADDED FRMW0004:00 32AC:0006 Wireless Radio Control seat0 default group4 cap:k
-event5 DEVICE_ADDED FRMW0004:00 32AC:0006 Consumer Control seat0 default group4 cap:kp scroll-nat
-event9 DEVICE_ADDED PIXA3854:00 093A:0274 Mouse seat0 default group5 cap:p left scroll-nat scroll-button
-event10 DEVICE_ADDED PIXA3854:00 093A:0274 Touchpad seat0 default group5 cap:pg size 111x73mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event1 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group6 cap:k
-event12 DEVICE_ADDED xremap seat0 default group7 cap:kp left scroll-nat scroll-button
event12 KEYBOARD_KEY +0.000s *** (-1) pressed
a event12 KEYBOARD_KEY +0.042s *** (-1) released
event12 KEYBOARD_KEY +1.438s *** (-1) pressed
event12 KEYBOARD_KEY +1.438s *** (-1) released
^[ event12 KEYBOARD_KEY +7.381s *** (-1) pressed
event12 KEYBOARD_KEY +7.523s *** (-1) pressed
Here's with xremap stopped:
-event0 DEVICE_ADDED Video Bus seat0 default group1 cap:k
-event2 DEVICE_ADDED Lid Switch seat0 default group2 cap:S
-event3 DEVICE_ADDED Power Button seat0 default group3 cap:k
-event4 DEVICE_ADDED FRMW0004:00 32AC:0006 Wireless Radio Control seat0 default group4 cap:k
-event5 DEVICE_ADDED FRMW0004:00 32AC:0006 Consumer Control seat0 default group4 cap:kp scroll-nat
-event9 DEVICE_ADDED PIXA3854:00 093A:0274 Mouse seat0 default group5 cap:p left scroll-nat scroll-button
-event10 DEVICE_ADDED PIXA3854:00 093A:0274 Touchpad seat0 default group5 cap:pg size 111x73mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on
-event1 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group6 cap:k
event1 KEYBOARD_KEY +0.000s *** (-1) pressed
a event1 KEYBOARD_KEY +0.049s *** (-1) released
event1 KEYBOARD_KEY +1.167s *** (-1) pressed
event1 KEYBOARD_KEY +1.247s *** (-1) released
event1 KEYBOARD_KEY +6.070s *** (-1) pressed
event1 KEYBOARD_KEY +6.550s *** (-1) pressed
^C
Thanks for the input! It does look like yours is behaving the same way as mine. Just to confirm, when you are typing something, you do not get any event coming through from the touchpad (in your case event10)?
Correct, here is my typing and the mouse cursor disappears roughly around third "a":
Thank you for the help -- could I bother you once more for another input from your setup?
I noticed I'm seeing the dwt
enabled for the main keyboard, not to xremap, when running libinput debug-events --verbose
:
$ libinput debug-events --verbose
libinput version: 1.26.1
(...snip...)
event16 - Asus Keyboard: is tagged by udev as: Keyboard Mouse
event16 - Asus Keyboard: device is a pointer
event16 - Asus Keyboard: device is a keyboard
... event2 - lid: keyboard paired with Lid Switch<->Asus Keyboard
event12 - HD-Audio Generic Mic: is tagged by udev as: Switch
event12 - not using input device '/dev/input/event12'
event14 - HD-Audio Generic Mic: is tagged by udev as: Switch
event14 - not using input device '/dev/input/event14'
event15 - HD-Audio Generic Headphone: is tagged by udev as: Switch
event15 - not using input device '/dev/input/event15'
event11 - ASUF1208:00 2808:0218 Mouse: is tagged by udev as: Mouse Pointingstick
event11 - ASUF1208:00 2808:0218 Mouse: device is a pointer
event13 - ASUF1208:00 2808:0218 Touchpad: is tagged by udev as: Touchpad
event13 - ASUF1208:00 2808:0218 Touchpad: kernel bug: missing right button, assuming it is a clickpad.
... event13 - thumb: enabled thumb detection (area)
event13 - ASUF1208:00 2808:0218 Touchpad: device is a touchpad
... event13 - lid: activated for ASUF1208:00 2808:0218 Touchpad<->Lid Switch
... event13 - palm: dwt activated with ASUF1208:00 2808:0218 Touchpad<->Asus Keyboard
event17 - xremap: is tagged by udev as: Keyboard Mouse
event17 - xremap: device is a pointer
event17 - xremap: device is a keyboard
This may be because of the timing xremap is loaded?
Sure. In both cases I pressed "a" and then ctrl-c to break event monitoring.
In my case the sequence does not matter of starting xremap does not matter. One interesting thing is that when xremap is started, I get dwt activated
twice -- one for physical touchpad, another for xremap.
Thank you so much, it's certainly acting differently in yours:
... event7 - palm: dwt activated with PIXA3854:00 093A:0274 Touchpad<->AT Translated Set 2 keyboard
event12 - xremap: is tagged by udev as: Keyboard Mouse
event12 - xremap: device is a pointer
event12 - xremap: device is a keyboard
... event2 - lid: keyboard paired with Lid Switch<->xremap
... event7 - palm: dwt activated with PIXA3854:00 093A:0274 Touchpad<->xremap
This is interesting, because it's doing the dwt setup first with the physical keyboard, and then also enabling xremap. It makes sense, but with my setup, I'm not seeing the latter part for xremap. I'm having a further read on libinput -- this doesn't seem to have anything to do with home-manager / NixOS user / system installation, but more to do with how the xremap is registered...
Thanks for all the help @VTimofeenko, I at least got some solution!
I could make this work with the Device quirks, especially with local-overrides.quirks
.
I've got the following in my Nix code for now. (This is for NixOS rather than home-manager.)
{ pkgs
, lib
, config
, ...}:
{
options = {
devices.keyboard.enable = lib.mkEnableOption "Enable keyboard related adjustment.";
};
config = lib.mkIf config.devices.keyboard.enable {
environment.etc."libinput/local-overrides.quirks".text =
''
[xremap]
MatchUdevType=keyboard
AttrKeyboardIntegration=internal
'';
};
}
With this in place, the dwt correctly captures the input coming from xremap as well. I am using home-manager version of xremap, and that seems to work fine.
It is rather odd how I have to do this as there was a fix for this introduced from https://github.com/xremap/xremap/pull/196. I may get to digging into the bottom of this at some point, but for now, I'm quite happy at least there is a solution for dwt to work correctly!
Great! I will add this to the doc.
If you're feeling adventurous, you could try overriding the xremap
input of this flake and pin it to the parent of the commit from that PR. The building machinery should work pretty much as is -- except maybe for the wlroots
feature.
I can see the latest version info with my xremap installation, but I can try specifying a commit indeed. There are some nuances with the above quirks addition, how it would affect all keyboards connected, not just xremap, so it would be the best if the upstream code can correctly handle this.
That's best reported upstream (well, in the xremap/xremap
repo). This repo is only about nix packaging and modules.
Ah yes, sorry I just meant that I should get to the bottom of this anyhow, because what I have got is probably because of some misconfiguration somewhere 😅 I'll report with my findings when I have more!
Hi folks -- sorry this is probably my misconfiguration somewhere, but I haven't been able to pinpoint what I have got wrong for the dwt, disable while typing support on NixOS using this flake... I was following https://github.com/xremap/xremap/issues/152, but did not have too much luck with it either.
I'm using niri (https://github.com/YaLTeR/niri) which supports dwt from libinput, and when I stop xremap, I can confirm that dwt is suppressing the touchpad correctly. But when xremap is running, touchpad is still fully active, leading to so many unexpected cursor movements.
The below is the snippet of my setup using home-manager.
I thought I may need to add the touchpad into the deviceNames, but when I do that, it becomes completely unresponsive. I think I'm missing something quite basic, but if anyone could shed some light, that would be much appreciated!