Kensington Expert Mouse Wireless on Wayland
Finally, here is a way how to configure and remap the Kensington Expert Mouse Wireless on Wayland.
Do you remember the promise I made in this post? Here I am to keep my promise and share with you how I've configured my Kensington Expert Mouse Wireless in Wayland. For the sake of the context, libinput is a library to handle input devices, and it works both in Wayland compositors and in the X.org display server providing basically a generic input driver.
I've moved to a plasma-wayland session now, it implements the Wayland protocol which is way-better than the ancient X11. Of course, we cannot use xinput anymore to modify libinput device properties, and, as we can read in libinput's Archlinux documentation:
For Wayland, there is no libinput configuration file. The configurable options depend on the progress of your desktop environment's support for them
Plasmadektop has some built-in capabilities to remap and configure input devices in its implementation, but actually I couldn't really make use of it. Therefore, let me introduce Input Remapper.
Input Remapper is a tool that allows to change the events mapping of the input devices.
It supports mice, keyboards, gamepads, X11, Wayland, combined buttons and programmable macros. Allows mapping non-keyboard events (click, joystick, wheel) to keys of keyboard devices.
Sounds promising, right? And know what? It works like a charm! Just install it, open the application, select Kensington Wireless TB Mouse and create a new preset giving a name like "Kensington Expert Mouse". Now, I could tell you how to remap everything manually from the UI, but for now, save this empty preset and close the application. Open the terminal and cd in your home directory at the following location:
cd ~/.config/input-remapper/Expert\ Wireless\ TB\ Mouse
Edit the file Kensington Expert Mouse.json pasting the following content:
{
"mapping": {
"1,273,1": [
"BTN_MIDDLE",
"mouse"
],
"1,275,1": [
"BTN_RIGHT",
"mouse"
],
"1,274,1": [
"Alt_L + Left",
"keyboard"
],
"2,8,1": [
"wheel(down,20)",
"mouse"
],
"2,8,-1": [
"wheel(up,20)",
"mouse"
]
}
}
Open again Input Remapper, select the Kensington Expert Mouse preset, enable "autoload" and click apply. Congratulations, you've just obtained the following trackball mapping:
The only drawback is related to the drag lock button and the middle emulation button configuration. This combination of the two configurations allows scrolling by holding the middle mouse button and using the ball to scroll. I gave a try to libinput-config in order to solve the problem, but my attempt was unsuccessful. I tried to capture the events using the command libinput debug-events to obtain the event IDs and use them in the /etc/libinput.conf config file like:
override-compositor=disabled
natural-scroll=enabled
accel-profile=adaptive
scroll-method=on-button-down
scroll-button=274
middle-emulation=enabled
drag-lock=enabled
remap-key=273:274
The scroll button seems to be detected, but the remap-key entries don't behave as expected, unfortunately. I'll keep you updated, I promise. Cheers! >_