#!/bin/bash # # fix-rog-z13-trackpad.sh # Enables "Disable while typing" (DWT) + palm rejection on the # ASUS ROG Flow Z13 folio keyboard touchpad. # # Usage: ./fix-rog-z13-trackpad.sh # (must be run as root) # # Tested on: CachyOS / Arch Linux, KDE Plasma 6, Wayland # Applies to: ROG Flow Z13 (2023 & 2025 models, USB 0b05:1a30) set -euo pipefail if [ "$(id -u)" -ne 0 ]; then echo "ERROR: This script must be run as root." echo "Usage: sudo ./fix-rog-z13-trackpad.sh" exit 1 fi echo "=== ROG Flow Z13 Trackpad Fix ===" echo "" # ────────────────────────────────────── # 1. udev rule — mark touchpad as internal # ────────────────────────────────────── UDEV_RULE="/etc/udev/rules.d/99-rog-z13-touchpad.rules" if [ -f "$UDEV_RULE" ]; then echo "[SKIP] $UDEV_RULE already exists" else echo "[CREATE] $UDEV_RULE" cat > "$UDEV_RULE" << 'EOF' # ROG Flow Z13 folio keyboard touchpad integration override # # The Z13's detachable folio keyboard connects via USB (0b05:1a30). # The touchpad on this device is correctly exposed as a touchpad, but # udev marks it as ID_INPUT_TOUCHPAD_INTEGRATION=external because the # USB device is flagged as "removable" (it's a detachable keyboard). # # Libinput refuses to enable "Disable While Typing" (DWT) for touchpads # marked as external, which greyed out the checkbox in KDE Plasma. # # This rule overrides the integration type to "internal" for the Z13 # touchpad only, which allows DWT pairing with the keyboard (already # marked internal via the libinput quirk in 50-system-asus.quirks). 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" EOF fi # ────────────────────────────────────── # 2. libinput quirk — mark keyboard as internal (belt-and-suspenders) # ────────────────────────────────────── LIBINPUT_QUIRKS="/etc/libinput/local-overrides.quirks" # Only create if it doesn't exist; if it does, it may have user customizations if [ -f "$LIBINPUT_QUIRKS" ]; then echo "[SKIP] $LIBINPUT_QUIRKS already exists (not overwriting)" else echo "[CREATE] $LIBINPUT_QUIRKS" mkdir -p /etc/libinput cat > "$LIBINPUT_QUIRKS" << 'EOF' [ROG Flow Z13 All USB Keyboards] MatchUdevType=keyboard MatchBus=usb MatchVendor=0x0B05 AttrKeyboardIntegration=internal EOF fi # ────────────────────────────────────── # 3. Apply udev changes # ────────────────────────────────────── echo "" echo "[APPLY] Reloading udev rules..." udevadm control --reload-rules echo "[APPLY] Triggering udev for existing devices..." udevadm trigger --subsystem-match=input echo "" echo "=== DONE ===" echo "" echo "The fix has been applied. To activate it:" echo "" echo " 1. Log out and log back in (or reboot)" echo " 2. Open System Settings -> Touchpad" echo " 3. Check \"Disable touchpad when typing\"" echo "" echo "The checkbox should now be available. If the touchpad already" echo "feels better at rejecting palm brushes while typing — that's" echo "expected. DWT and improved palm rejection both activate when" echo "the touchpad is recognized as internal." echo "" echo "To undo this fix later, run:" echo " sudo rm /etc/udev/rules.d/99-rog-z13-touchpad.rules" echo " sudo rm /etc/libinput/local-overrides.quirks" echo " sudo udevadm control --reload-rules" echo " sudo udevadm trigger --subsystem-match=input" echo ""