summary refs log tree commit diff stats
path: root/bin/touchpad_enable_tap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/touchpad_enable_tap.sh')
-rwxr-xr-xbin/touchpad_enable_tap.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/touchpad_enable_tap.sh b/bin/touchpad_enable_tap.sh
index d4ac1cb..938c652 100755
--- a/bin/touchpad_enable_tap.sh
+++ b/bin/touchpad_enable_tap.sh
@@ -1,18 +1,19 @@
 #!/bin/sh
 set -eu
 
-# This enables tapping, like tap-to-click, on the Thinkpad T14s Gen2 AMD.
+# This enables tapping, like tap-to-click, on laptops.
 # The touchpad ID changes between reboots sometimes.
+# So does the property ID for tapping.
 #
-# We need property 318, "Tapping Enabled".
+# We need the property "Tapping Enabled".
 # Available properties viewable with:
 #       xinput list-props $TOUCHPAD_ID
 #
 # Requires:
 #       xinput, libinput
 
-TOUCHPAD_ID="$(xinput | grep Touchpad | awk '{print $6}' | cut -d'=' -f2)"
-TAPPING_PROP_ID="$(xinput list-props 14 | grep 'Tapping Enabled (' | cut -d'(' -f2 | cut -d')' -f1)"
+TOUCHPAD_ID="$(xinput | awk '/Touchpad/ {split($6, a, "="); print a[2]}')"
+TAPPING_PROP_ID="$(xinput list-props "$TOUCHPAD_ID" | awk '/Tapping Enabled \(/ {split($4, a, "[()]"); print a[2]}')"
 
 printf 'Touchpad ID:\t%s\n' "$TOUCHPAD_ID"
 printf 'Tapping Prop:\t%s\n' "$TAPPING_PROP_ID"