-
-
Notifications
You must be signed in to change notification settings - Fork 24
How to enable palm rejection on virtual keyboard
Article contents graciously provided by a Toshy user in issue #148.
If you have installed Toshy on a laptop, you may notice that palm rejection is disabled when you start Toshy services (i.e. you will get random touchpad movement and taps register while typing, which can change window focus and do other annoying things).
The underlying cause is that in GNOME (at least for standard setups), palm rejection is only enabled for "internal" keyboards, and the virtual keyboard created by the keymapper utility Toshy uses is not marked as an internal device. We can change this by adding a quirk to libinput
(the driver that handles most input devices).
Note
This guide has been created using a laptop running Ubuntu 23.10. It may work or require modifications with other laptops.
By default Ubuntu uses libinput
, but other distros may use something else. Running lsinput
or xinput
and xinput list-props <id>
might give some indication, but I don't yet have a reliable way of determining this. (For instance, on my AMD laptop I can't confirm the driver, but on my desktop running lsinput mentions libinput as the driver).
Firstly, you may need to install the libinput
command line tools:
sudo apt install libinput-tools
This provides the libinput
CLI tool which can be used to verify that you have created the device quirk properly.
Next, as root create a local overrides quirk (following the instructions here).
sudo mkdir /etc/libinput
sudo vim /etc/libinput/local-overrides.quirks
Add the following to the file local-overrides.quirks
:
[Toshy Virtual Keyboard]
MatchUdevType=keyboard
MatchName=*(virtual) Keyboard
AttrKeyboardIntegration=internal
This wildcard match should work for both older Toshy installs using keyszer
, and newer Toshy installs that have been switched to using xwaykeyz
(forked from keyszer
). Each will have their own keyboard device name shown in the device list, like so:
Keyszer (virtual) Keyboard
XWayKeyz (virtual) Keyboard
You can confirm the name of the device by running libinput list-devices
or toshy-devices
.
Take careful note, trailing spaces or any other formatting issues will cause the quirks parser to fail (and may affect other quirks as well).
We can verify that the quirk is parsed correctly by running libinput list-devices
, finding the correct kernel device in the output (which will look like /dev/input/eventXX
), and running
libinput quirks list /dev/input/eventXX
You should see AttrKeyboardIntegration=internal
in the output.
At this stage the driver hasn't actually loaded the quirk - this requires a restart. (It may be possible that logging out and in would also work, but hasn't been tested). For an external device, the new setting may be applied by just disconnecting and reconnecting the device, but for internal devices logging out is probably the minimum necessary to enable the new quirks settings for the device.