Trying to implement custom mouse acceleration
Alicja
arisuwu.mei at gmail.com
Sun Mar 29 14:07:23 BST 2026
Hello,
I'm trying to implement a custom mouse acceleration in KWin. It's really
important for me, because I have problems with my wrist and good custom
configuration reduces my wrist's pain. At this moment, I'm using X11
session which allows me to setup custom mouse acceleration in terminal
via xinput commands. However, I would like to switch to Wayland. I found
out that such features are implemented in the KWin code.
I downloaded and built the plasma-workspace code with kde-builder. I
wrote Q_PROPERTIES, config data and methods to handle custom
acceleration profile.
Here is a function I wrote that is supposed to change the step of the
custom acceleration profile:
void Device::setPointerCustomAccelerationStep(qreal step)
{
if (step <= 0) {
return;
}
auto libinputAccelConfig =
libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
if (libinput_config_accel_set_points(libinputAccelConfig,
LIBINPUT_ACCEL_TYPE_MOTION, step,
m_pointerCustomAccelerationPoints.size(),
m_pointerCustomAccelerationPoints.data()) ==
LIBINPUT_CONFIG_STATUS_SUCCESS) {
if (libinput_device_config_accel_apply(m_device,
libinputAccelConfig) == LIBINPUT_CONFIG_STATUS_SUCCESS) {
m_pointerCustomAccelerationStep = step;
}
}
libinput_config_accel_destroy(libinputAccelConfig);
}
However, when I'm trying to build KWin with my modifications, I get
errors about undefined references to all of the libinput functions
needed to tweak custom acceleration. Those are:
libinput_config_accel_create, libinput_config_accel_destroy,
libinput_config_accel_set_points, libinput_device_config_accel_apply.
From what I understand, it means that those functions have not been
implemented.
Where could I find the implementation of all libinput things? I could
then write an implementation for those I need. I tried to search of
already used libinput functions like
'libinput_device_config_accel_set_speed' but I only found implemention
for them in mock_libinput.cpp in autotests.
Regards,
ArisuwuMei
More information about the Plasma-devel
mailing list