This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to Configure Input Devices under Wayland

Tags: None
(comma "," separated)
User avatar
zanny
Registered Member
Posts
10
Karma
0
OS
5.12 is a great release for Wayland, its been near-usable on every system I've tried on it, and one of the only pain points is input device configuration (particularly in regards to dreaded default-on mouse acceleration). If you have that same problem with any keyboard or mouse I found a solution!

Under X you would use the Input KCMs or Xinput to configure keyboards and mice, but under Wayland the KCMs don't work (not even the third party input-devices KCM). To configure input devices in Wayland, you need two things. First is to know the hardware event names of the devices you care about. You can find these by checking which /dev/input/eventX your device names symlink to in /dev/input/by-id or via libinput list-devices as root. Once you know the numerical values of any devices you want to configure, you need a dbus editor. Qt provides qdbusviewer, usually as an optional package. Either search which package provides qdbusviewer or look for a qt-tools package in your distro. Any general purpose dbus editor will work though, so use whatever you like.

KWin under Wayland advertises its libinput tunables under the Dbus namespace org.kde.KWin.org.kde.KWin.InputDevice.eventX where X is the aforementioned number you needed to find out. Unlike with libinput list-devices Kwin shows every possible property it supports on every device, so you need to know what properties your device actually supports before trying to set them, and any properties not advertised under this Dbus interface aren't configurable in Wayland yet (at least until Kwin advertises them, file a bug report!).

For example, I use this interface to set my mouses acceleration profile to flat, and to do that I navigate to its event in dbus and set pointerAccelerationProfileFlat to true (note that Kwin properly treats the two acceleration profile booleans as mutually exclusive - setting flat unsets adaptive). Kwin will remember some properties like the acceleration profile but not others like the pointerAcceleration parameter (at least for my mouse, YMMV). My mouse is way too fast under both X and Wayland for my tastes, so to slow it down I set pointerAcceleration to -0.85. To keep this setting persistently through reboots, I create an autostart script to set this dbus parameter using qdbus, the command line version of qdbusviewer that is included in the same package:

Code: Select all
name="usb-Logitech_G500_B7371E55A60018-event-mouse"
e=$(basename $(readlink /dev/input/by-id/$name))
qdbus org.kde.KWin /org/kde/KWin/InputDevice/$e \
    org.kde.KWin.InputDevice.pointerAcceleration -0.85


You can just add such a script to be run automatically via the Autostart page in system settings. qdbus is nice in that it autocompletes everything up to setting the values, so if you know where to look via the viewer you can just tab your way to your destination. Do note how I use the device name rather than the event number in this script - the event numbers are volatile between boots so you can't expect a device to always be at the same number. Also note that some devices that do work under libinput don't work under KWin_wayland yet - my non-Wacom tablet for example just doesn't work under a Wayland session at all. Device support can only improve from here, though!

This process isn't the best UX ever, but with this I can start using Wayland regularly and hopefully it helps someone else make the leap, at least until we see an official KCM for Wayland Input configuration.


Bookmarks



Who is online

Registered users: Bing [Bot], gfielding, Google [Bot], Sogou [Bot]