rog-z13-trackpad-fix/README.md

147 lines
4.3 KiB
Markdown
Raw Normal View History

# 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 ~300500ms 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)