Skip to content

WIP: Add ability to modify tap button mapping and drag lock on touchpad in Wayland

Giusy Margarita requested to merge kurmikon/mutter:wip/tap_map_drag_lock into master

Hello, I'd like to add tap button map and drag lock libinput touchpad options in Gnome. This ones are missing now and they can only be changed through Xorg configuration, so there's no way to manage them in Wayland since they are missing in mutter.

I didn't really know how to do this, but reading the libinput documentation and consulting mutter code, I was able to compile and run two modified version of mutter and gsettings on my Arch Linux which in theory have support to these setting, but practically I'm not able to change the options, so I'd like to discuss here what's missing and maybe fix and merge the pull request.

If you see the commit, I inserted the following two libinput functions in mutter:

Then I added the two options to gsettings:

gsettings diff
diff --git a/headers/gdesktop-enums.h b/headers/gdesktop-enums.h
index 540c4c7..2ab6643 100644
--- a/headers/gdesktop-enums.h
+++ b/headers/gdesktop-enums.h
@@ -177,6 +177,13 @@ typedef enum
   G_DESKTOP_TOUCHPAD_CLICK_METHOD_FINGERS
 } GDesktopTouchpadClickMethod;
 
+typedef enum
+{
+  G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_DEFAULT,
+  G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_LRM,
+  G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_LMR
+} GDesktopTouchpadTapButtonMap;
+
 typedef enum
 {
   G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED,
diff --git a/schemas/org.gnome.desktop.peripherals.gschema.xml.in b/schemas/org.gnome.desktop.peripherals.gschema.xml.in
index 9f99d8d..d1f1d06 100644
--- a/schemas/org.gnome.desktop.peripherals.gschema.xml.in
+++ b/schemas/org.gnome.desktop.peripherals.gschema.xml.in
@@ -29,11 +29,21 @@
       <summary>Enable mouse clicks with touchpad</summary>
       <description>Set this to TRUE to be able to send mouse clicks by tapping on the touchpad.</description>
     </key>
+    <key name="tap-button-map" enum="org.gnome.desktop.GDesktopTouchpadTapButtonMap">
+      <default>'lrm'</default>
+      <summary>Tap Button Map</summary>
+      <description>Set the finger number to button number mapping for tap-to-click. The default mapping is to have a 1, 2 and 3 finger tap to map to the left, right and middle button ("lrm"), respectively.</description>
+    </key>
     <key name="tap-and-drag" type="b">
       <default>true</default>
       <summary>Enable tap-and-drag with touchpad</summary>
       <description>Set this to TRUE to be able to start a drag by tapping and immediately moving the finger that’s now pressed on the touchpad.</description>
     </key>
+    <key name="tap-and-drag-lock" type="b">
+      <default>false</default>
+      <summary>Enable tap-and-drag-lock with touchpad</summary>
+      <description>Set this to TRUE to lock the dragging process within a short timeout when the finger is lifted on the touchpad and tap-and-drag setting is enabled.</description>
+    </key>
     <key name="send-events" enum="org.gnome.desktop.GDesktopDeviceSendEvents">
       <default>'enabled'</default>
       <summary>Touchpad enabled</summary>

These compiles and does not crash on my system (obviously building gsettings prior to mutter). The two new settings are showed inside dconf-editor.

screenshot Schermata_del_2020-06-11_18-23-38

But when I change them, nothing happens. I don't understand what it's not working since the functions I added are behaving the same way as the others, but there's something I am missing and I hope you can help me to complete this work.

Merge request reports