Skip to content

Instantly share code, notes, and snippets.

@fritschy
Created October 25, 2016 21:39
Show Gist options
  • Save fritschy/2b5cc37ab820311f03423d5e9392eee2 to your computer and use it in GitHub Desktop.
Save fritschy/2b5cc37ab820311f03423d5e9392eee2 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -eu
tpid=0
for id in $(xinput list --id-only)
do
if xinput list-props $id | grep -q "^Device 'SynPS/2 Synaptics TouchPad':"
then
tpid=$id
break
fi
done
if [ $tpid -eq 0 ]
then
logger -t $0 no touchpad found...
exit 1
fi
get_prop_id() {
echo "$1" | cut -d'(' -f2 | cut -d')' -f1
}
get_prop() {
xinput list-props $tpid | grep "$1 (" | cut -d'(' -f2 | cut -d')' -f1
}
x() {
echo "$@"
eval "$@"
}
set_prop() {
x xinput set-prop $tpid $1 $2
}
set_prop $(get_prop "libinput Tapping Enabled") 1
set_prop $(get_prop "libinput Natural Scrolling Enabled") 1
set_prop $(get_prop "libinput Middle Emulation Enabled") 1
set_prop $(get_prop "libinput Accel Speed") 0.85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment