diff --git a/CLAUDE.md b/CLAUDE.md index d883ebe..4ee4d96 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,8 +7,7 @@ the touchpad to be misclassified as "external," blocking DWT in KDE Plasma. ## Files - `fix-rog-z13-trackpad.sh` — install script (run with sudo) -- `ROG_Flow_Z13_trackpad_fix_reference.txt` — full documentation -- `rules/99-rog-z13-touchpad.rules` — standalone copy of the udev rule +- `README.md` — full documentation ## System Files Created - `/etc/udev/rules.d/99-rog-z13-touchpad.rules` — marks touchpad as internal diff --git a/README.md b/README.md new file mode 100644 index 0000000..9a789bc --- /dev/null +++ b/README.md @@ -0,0 +1,146 @@ +# ROG Flow Z13 — Touchpad DWT & Palm Rejection Fix + +Fixes the **"Disable while typing"** checkbox being greyed out in KDE Plasma +and enables proper palm rejection on the ASUS ROG Flow Z13 folio keyboard touchpad. + +**Device:** ROG Flow Z13 (2023 & 2025 models, USB `0b05:1a30`) +**OS:** CachyOS / Arch Linux, KDE Plasma 6, Wayland + +--- + +## The Problem + +The Z13's magnetic folio keyboard connects via **USB**. Because it's detachable, +the kernel flags the USB device as `removable`. Systemd's `65-integration.rules` +then sets: + +``` +ID_INPUT_TOUCHPAD_INTEGRATION=external +``` + +on the touchpad. **Libinput refuses to enable Disable-While-Typing (DWT) for +external touchpads**, so KDE greys out the checkbox. + +The libinput package ships a built-in quirk (`50-system-asus.quirks`) that marks +the **keyboard** interface as internal, but there is no libinput quirk attribute +to mark a **touchpad** as internal. The keyboard was handled — the touchpad was not. + +### How the folio exposes itself + +| Event | Role | Status | +|-------|------|--------| +| `event3` | Vendor keys | — | +| `event4` | Keyboard | Marked internal by libinput quirk | +| `event7` | Mouse pointer | — | +| `event8` | **Touchpad** | 🛑 Was marked external | + +The keyboard and touchpad share the same `LIBINPUT_DEVICE_GROUP`, so they *can* +be paired for DWT — but only if **both** are internal. + +--- + +## The Fix + +### Layer 1 — Mark the keyboard as internal + +**Already handled** by the system's built-in libinput quirk at +`/usr/share/libinput/50-system-asus.quirks`: + +```ini +[Asus ROG FLow Z13 2025 keyboard] +MatchUdevType=keyboard +MatchBus=usb +MatchVendor=0x0B05 +MatchProduct=0x1A30 +AttrKeyboardIntegration=internal +``` + +The install script also creates a local override at +`/etc/libinput/local-overrides.quirks` as a broader catch-all for any ASUS +USB keyboard. + +### Layer 2 — Mark the touchpad as internal + +**A udev rule** (`/etc/udev/rules.d/99-rog-z13-touchpad.rules`) overrides the +integration type after `65-integration.rules` has already set it to `external`: + +```udev +ACTION=="add|change", SUBSYSTEM=="input", \ + ENV{ID_VENDOR_ID}=="0b05", ENV{ID_MODEL_ID}=="1a30", \ + ENV{ID_INPUT_TOUCHPAD}=="1", \ + ENV{ID_INPUT_TOUCHPAD_INTEGRATION}="internal" +``` + +**Why this works:** +- Runs at priority **99** (after `65-integration.rules` at priority 65) +- Only matches the Z13 folio (`0b05:1a30`) +- Only affects the touchpad interface (`ID_INPUT_TOUCHPAD=1`) +- Sets `ID_INPUT_TOUCHPAD_INTEGRATION=internal`, which libinput reads at runtime + +### The result + +With both keyboard + touchpad recognized as internal: + +1. **The "Disable while typing" checkbox becomes available** in KDE System + Settings → Touchpad +2. **DWT activates** — the touchpad is ignored for ~300–500ms after any keypress +3. **Palm rejection improves** — libinput applies more aggressive defaults for + internal touchpads (larger exclusion zones, lower palm pressure thresholds) + +--- + +## Usage + +```bash +# Clone the repo +git clone ssh://git@forgejo.fifthdread.com:223/Fifthdread/rog-z13-trackpad-fix.git +cd rog-z13-trackpad-fix + +# Run the install script (as root) +sudo ./fix-rog-z13-trackpad.sh +``` + +Then log out and back in. Open **System Settings → Touchpad** — the +"Disable touchpad when typing" checkbox should now be available. + +### Reverting + +```bash +sudo rm /etc/udev/rules.d/99-rog-z13-touchpad.rules +sudo rm /etc/libinput/local-overrides.quirks +sudo udevadm control --reload-rules +sudo udevadm trigger --subsystem-match=input +``` + +--- + +## Troubleshooting + +**Verify the udev rule is loaded:** +```bash +udevadm info --query=property /dev/input/event8 | grep INTEGRATION +# Should show: ID_INPUT_TOUCHPAD_INTEGRATION=internal +``` + +**Verify the keyboard quirk is applied:** +```bash +sudo libinput quirks list /dev/input/event4 +# Should show: AttrKeyboardIntegration=internal +``` + +**Verify DWT is enabled:** +```bash +sudo libinput list-devices | grep -A15 "Touchpad" +# Should show: Disable-w-typing: enabled +``` + +> Your event numbers may differ (e.g. after a kernel update). Run +> `sudo libinput list-devices` to find the correct ones. + +--- + +## References + +- [libinput Device Quirks](https://wayland.freedesktop.org/libinput/doc/latest/device-quirks.html) +- [Linux Touchpad Dev Guide — DWT](https://linuxtouchpad.org/libinput/2022/05/07/disable-while-typing.html) +- [libinput — Disable While Typing](https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#disable-while-typing) diff --git a/ROG_Flow_Z13_trackpad_fix_reference.txt b/ROG_Flow_Z13_trackpad_fix_reference.txt deleted file mode 100644 index 5bfab58..0000000 --- a/ROG_Flow_Z13_trackpad_fix_reference.txt +++ /dev/null @@ -1,139 +0,0 @@ -ROG Flow Z13 — Touchpad Palm Rejection / DWT Fix -================================================== -Created: 2026-05-13 -Device: ASUS ROG Flow Z13 (folio keyboard, USB 0b05:1a30) -OS: CachyOS (Arch Linux) -KDE: Plasma 6 (Wayland) -Issue: "Disable while typing" checkbox greyed out in Touchpad settings - -===================================================================== - PROBLEM SUMMARY -===================================================================== - -The ROG Flow Z13's magnetic folio keyboard connects via USB. Since it's -a detachable keyboard, the kernel marks the USB device as "removable." -Systemd's 65-integration.rules uses this to set: - - ID_INPUT_TOUCHPAD_INTEGRATION=external - -on the touchpad. Libinput refuses to enable "Disable While Typing" (DWT) -for external touchpads, and KDE respects this by greying out the checkbox. - -The libinput quirks system ships a quirk (50-system-asus.quirks) that -marks the KEYBOARD interface as internal, but there is no libinput quirk -attribute to mark a TOUCHPAD as internal — so the touchpad remained -external despite the keyboard being correctly handled. - -The USB device exposes these input nodes: - - event3 — Vendor keys (HID interface 1.0) - event4 — Keyboard (HID interface 1.2) ← quirk marks internal - event7 — Mouse (HID interface 1.3) - event8 — Touchpad (HID interface 1.3) ← was marked external - -Both keyboard and touchpad share the same LIBINPUT_DEVICE_GROUP, so -they *can* be paired for DWT — but only if both are internal. - -===================================================================== - FILES INVOLVED -===================================================================== - -1. /usr/share/libinput/50-system-asus.quirks [SYSTEM — do not edit] - ---------------------------------------------------------------- - The libinput package ships this file. It includes a quirk: - - [Asus ROG FLow Z13 2025 keyboard] - MatchUdevType=keyboard - MatchBus=usb - MatchVendor=0x0B05 - MatchProduct=0x1A30 - AttrKeyboardIntegration=internal - - This correctly marks the keyboard interface as internal, but since - MatchUdevType=keyboard, it does not affect the touchpad. - - This file is overwritten on libinput updates. Do not modify it. - -2. /etc/libinput/local-overrides.quirks [USER — was already present] - ---------------------------------------------------------------- - A broader local override that matches all ASUS USB keyboards: - - [ASUS ROG Flow Z13 All USB Keyboards] - MatchUdevType=keyboard - MatchBus=usb - MatchVendor=0x0B05 - AttrKeyboardIntegration=internal - - This is redundant with the system quirk above (it's less specific - since it matches any ASUS keyboard product ID). It's harmless and - can be kept or removed — the system quirk alone is sufficient for - the keyboard side. If kept, it serves as a catch-all for future - ASUS folio keyboards with different product IDs. - -3. /etc/udev/rules.d/99-rog-z13-touchpad.rules [USER — NEW, created for fix] - ---------------------------------------------------------------- - The actual fix. This udev rule overrides the touchpad's integration - type from "external" to "internal": - - ACTION=="add|change", SUBSYSTEM=="input", \ - ENV{ID_VENDOR_ID}=="0b05", ENV{ID_MODEL_ID}=="1a30", \ - ENV{ID_INPUT_TOUCHPAD}=="1", \ - ENV{ID_INPUT_TOUCHPAD_INTEGRATION}="internal" - - How it works: - - Matches input events from the Z13 folio (USB 0b05:1a30) - - Only affects touchpad devices (ID_INPUT_TOUCHPAD=1) - - Runs after systemd's 65-integration.rules (which set it to "external") - - Changes ID_INPUT_TOUCHPAD_INTEGRATION to "internal" - - Libinput picks up this udev property at runtime, which: - a) Unlocks the "Disable while typing" checkbox in KDE - b) Enables DWT behavior (touchpad ignored ~300-500ms after keypress) - c) Enables libinput's more aggressive palm rejection defaults for - internal touchpads (larger exclusion zones, lower palm thresholds) - -===================================================================== - REVERTING -===================================================================== - -To undo the fix, delete the udev rule and reload: - - sudo rm /etc/udev/rules.d/99-rog-z13-touchpad.rules - sudo udevadm control --reload-rules && sudo udevadm trigger - -The keyboard quirks files can remain as-is — they only affect the -keyboard and don't cause issues on their own. - -Optionally also remove: - - sudo rm /etc/libinput/local-overrides.quirks - -===================================================================== - TROUBLESHOOTING -===================================================================== - -If DWT still doesn't work after applying: - -1. Verify the udev rule is loaded: - udevadm info --query=property /dev/input/event8 | grep INTEGRATION - Should show: ID_INPUT_TOUCHPAD_INTEGRATION=internal - -2. Verify the keyboard quirk is applied: - sudo libinput quirks list /dev/input/event4 - Should show: AttrKeyboardIntegration=internal - -3. Verify both devices are recognized: - sudo libinput list-devices | grep -A15 "Touchpad" - Should show: Disable-w-typing: enabled - -4. If you changed the event number (e.g. after a kernel update), re-check: - sudo libinput list-devices - Look for your touchpad and keyboard event numbers, then re-verify. - -===================================================================== - REFERENCES -===================================================================== - -- libinput Device Quirks: https://wayland.freedesktop.org/libinput/doc/latest/device-quirks.html -- Linux Touchpad Dev Guide: https://linuxtouchpad.org/libinput/2022/05/07/disable-while-typing.html -- libinput DWT docs: https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#disable-while-typing