summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenjamin Morrison <ben@gbmor.org>2022-04-20 21:33:21 -0400
committerBenjamin Morrison <ben@gbmor.org>2022-04-20 21:33:46 -0400
commitd6a6dae683459375f27567766b29a4f8d5f35a2a (patch)
treeddebb3f915e38f16e351b3da781e7ffc3464ea04
parent81bbc8fab32528db5eea0e504c38e7c7af1c4faf (diff)
downloaddogfiles-d6a6dae683459375f27567766b29a4f8d5f35a2a.tar.gz
cleaned up touchpad tap enable script.
thanks june.
-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"