Touchpad and Mouse configuration

The built-in touchpad for my laptop is configured in /etc/X11/xorg.conf.d/30-touchpad. This just enables tapping and "natural" scrolling, while also disabling the extremely annoying tap-to-drag behaviour:

Section "InputClass"
	Identifier "touchpad"
	Driver "libinput"
	MatchIsTouchpad "on"
	Option "Tapping" "on"
	Option "TappingButtonMap" "lrm"
	Option "NaturalScrolling" "on"
	Option "TappingDrag" "off"
	Option "ClickMethod" "clickfinger"
EndSection

The mouse configuration is slightly more complicated — I have a Logitech MX Master 2 which is configured via the logid programme (part of logiops). This configures the thumb button as middle-click as the scroll wheel is so sensitive it's impossible to accurately click it. It also enables "natural" scrolling:

devices: ({
  name: "Wireless Mouse MX Master 2S";
  dpi: 1000;
  smartshift:
  {
    on: true;
    threshold: 20;
  };
  hiresscroll:
  {
    hires: true;
    invert: true;
  };
  thumbwheel:
  {
    divert: true;
    left =
    {
        type: "Keypress";
        keys: ["KEY_LEFTCTRL", "KEY_PAGEUP"];
    }
    right =
    {
        type: "Keypress";
        keys: ["KEY_LEFTCTRL", "KEY_PAGEDOWN"];
    }
  };
  buttons: (
    { cid: 0xc3; action = { type: "Keypress"; keys: ["BTN_MIDDLE"]; }; }
  );
});

Logid disconnection issue

<aside> 🐞 logid has to be run as a service, and sometimes the scroll behaviour reverts to old-style scrolling ("unnatural"?) — this just requires service restart logid to fix it.

</aside>

This can be fixed by tying the logid service to the bluetooth target, which requires modifying the service file as per this pull request. Unfortunately, this cannot be done more generally as not all devices use bluetooth, and the exact device path is uncertain. Here is a patch which can achieve this:

From 5183394cdf59a1427288a57b93e4b05f67b756bc Mon Sep 17 00:00:00 2001
From: Gideon Farrell <[email protected]>
Date: Sat, 23 Oct 2021 15:18:28 +0100
Subject: [PATCH] run service After bluetooth.target

When systemd starts logid.service without taking bluetooth.target into
account, you see the following error for some device N:

    [WARN] Error adding device /dev/hidrawN: std::exception

Restarting the service with `systemctl restart logid` fixes it. This
also happens on wake from suspend.

This commit adds After=bluetooth.target to the service unit definition
which fixes the problem.
---
 src/logid/logid.service.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/logid/logid.service.cmake b/src/logid/logid.service.cmake
index dd4e09b..8677822 100644
--- a/src/logid/logid.service.cmake
+++ b/src/logid/logid.service.cmake
@@ -1,7 +1,7 @@
 [Unit]
 Description=Logitech Configuration Daemon
 StartLimitIntervalSec=0
-After=multi-user.target
+After=multi-user.target bluetooth.target
 Wants=multi-user.target
 
 [Service]
-- 
2.33.1