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
