summaryrefslogtreecommitdiff
path: root/.scripts/toggle_touchpad.sh
blob: de781ababebea01bf57d0a88de5df7d707fe45fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

~/.scripts/toggle_user_unit.sh disable-touchpad.service && exit

which synclient &> /dev/null || exit

exec synclient TouchpadOff=$((1-$(synclient | awk '/TouchpadOff/ { print $3 }')))

device_id=$(xinput list | sed -n "s/^.*Synaptics.*id=\([^\t]*\).*$/\\1/p")

enabled=$(xinput list-props $device_id | sed -n "s/^.*Device Enabled.*\t\(.*\)$/\\1/p")
property=$(xinput list-props $device_id | sed -n "s/^.*Device Enabled (\([^)]*\)).*$/\\1/p")


xinput set-prop $device_id $property $((1-enabled))