In order to work under KWin Wayland the Touchpad KCM needed to be adjusted. In theory this should have meant only the creation of an additional backend. But since a libinput based touchpad configuration utility needs to be in many ways different than the legacy X version the decision was made to redesign the user interface aswell.
- Changes the configuration of each connected touchpad individually
- Saves changes per device (through the KWin libinput backend) in a config file.
- Quick switch between devices via drop-down list.
- Loads and removes devices on the fly on hotplugging events and informs the user with animated messages.
- Visual indication if a property is not supported by a device
- Tooltips give additional informations about available options
The KCModule was redesigned as a container, which loads on opening a X or Wayland plugin dependent on the active windowing system. In the X case it loads the legacy QWidget, which was untouched besides integration work in the new plugin structure. In the Wayland case, it loads the new QML based user interface, which was written from scratch.
The user interface then instantiates appropriate backend. In the X case it loads the old backend, which was also not changed. The Wayland backend was created aswell from scratch.
KWinWaylandBackend queries available devices from KWin via D-Bus and creates KWinWaylandTouchpad instances for each available touchpad.
KWinWaylandTouchpad gets via D-Bus all properties from KWin, which are relevant for a touchpad and saves them in property structs. This includes: Boolean if the property is supported by the specific touchpad. Default and reset values for the generic KCModule actions. And the D-Bus name in order to write changes back later on
When requested by the KCModule, the backend sends all changed values back to KWin, which then forwards them to libinput and saves them in its config file. The backend also connect to KWin signals over D-Bus, which emit in case a touchpad gets disconnected or another one additionally connected.
Loads the device list from the backend and all properties of the selected touchpad. If a value gets changed in the ui, it writes directly back to the KWinWaylandTouchpad instance.
If there is no touchpad available an info message is shown and the control elements get disabled. If a touchpad is then connected, it is automatically loaded and the message vanishes. A similar message is shown when disconnecting the touchpad with currently opened configuration.
Requests for help / future work:
I need in particular feedback on my QML coding. I hope it's fine in general but there is most certainly stuff to be improved. Also the option and tooltip texts need someone else to take a look on.
The touchpad in my laptop doesn't support "Scroll-on-Button-Down". Since I would've needed to test the functionality somehow while coding, I didn't implement it yet and only did some ground work.
The hot plug handling seems a bit overengineered for touchpads, which are normally permanently installed. But most functionality of this KCM in general could be transferred to a new Wayland based Mouse KCM, which also could need an overhaul. Maybe this could be a project for a just starting contributer, since it would involve different areas of Plasma/KWin while there is already a similar example with the Touchpad KCM.
This change implements T4460.