#!/bin/bash # zephyrus-touchpad reset | toggle — apply the touchpad's settings again, or switch it on or off. # Shipped by the mesh's asus-zephyrus-g14 module; edit the catalogue. # # The settings themselves are an X input class (/etc/X11/xorg.conf.d/30-asus-zephyrus-g14-touchpad.conf), # which X applies every time the device appears — after a resume too, which is what the predecessor's # sleep hook existed for. This is the manual form, bound to the touchpad key. set -u here=$(dirname "$0") name=$("$here/zephyrus-session" xinput list --name-only 2>/dev/null | grep -m1 -i 'touchpad') [ -n "$name" ] || { echo "zephyrus-touchpad: no touchpad in this session" >&2; exit 1; } x() { "$here/zephyrus-session" xinput "$@"; } case "${1:-reset}" in reset) x set-prop "$name" "libinput Tapping Enabled" 1 x set-prop "$name" "libinput Natural Scrolling Enabled" 1 x set-prop "$name" "libinput Accel Speed" 0.15 x enable "$name" "$here/zephyrus-session" "$here/zephyrus-notify" 7779 "Touchpad: reset" ;; toggle) if x list-props "$name" | grep -q 'Device Enabled ([0-9]*):[[:space:]]*1'; then x disable "$name"; "$here/zephyrus-session" "$here/zephyrus-notify" 7779 "Touchpad: off" else x enable "$name"; "$here/zephyrus-session" "$here/zephyrus-notify" 7779 "Touchpad: on" fi ;; *) echo "usage: zephyrus-touchpad reset | toggle" >&2; exit 2 ;; esac