Last active
July 28, 2021 19:42
-
-
Save NoraCodes/13c5c2f9e6b161b2ce56fbdf97a3bb17 to your computer and use it in GitHub Desktop.
Apple Magic Touchpad 2 configuration script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# XInput/Synclient settings for Apple Magic Touchpad 2 | |
# AGPL v3.0 or greater at your option | |
# (C) Leonora Tindall 2021 | |
# Based on a Reddit post by /u/fr3lld | |
# and a very helpful AskUbuntu response by Jamie Scott | |
# Place this somewhere, set it as executable, and place the filename | |
# in in ~/.xinitrc | |
set -e | |
ID="$(xinput | grep "Apple Inc. Magic Trackpad 2" | cut -d "=" -f 2 | cut -f 1)" | |
if [ -z "$ID" ]; then | |
echo "No AMT2 found in xinput list; aborting." | |
exit 1 | |
fi | |
echo "AMT2 is ID '$ID'" | |
PROP="$(xinput list-props $ID | grep " Finger " | cut -d "(" -f 2 | cut -d ")" -f 1)" | |
if [ -z "$PROP" ]; then | |
echo "No Finger property found in xinput list; aborting." | |
exit 2 | |
fi | |
echo "AMT2 Finger property is ID '$PROP'" | |
echo "Setting $ID:$PROP to 2, 2, 0" | |
xinput set-prop "$ID" "$PROP" 2, 2, 0 | |
echo "Setting synclient options" | |
synclient ClickFinger3=2 | |
synclient HorizTwoFingerScroll=1 | |
synclient TapButton2=0 | |
synclient TapButton1=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creating a configuration file in
/etc/X11/xorg.conf.d
instead of this script should make settings persistent across system restarts. See https://askubuntu.com/a/1316185/201097