Toggle on/off the touchpad of your notebook in linux

In case you may get annoyed when typing in your favorite editor in Linux by touching the Notebook Touchpad by mistake and doing strange actions, you can choose to temporarily disabled or toggle it.
Here is a little script, you can run it once per session and it won’t be permanent after a reboot.
This has been tested under CentOS 6.x and RedHat 6.x

$ cat ~/


DEVID=$(xinput list|grep “PS/2 Generic Mouse”|sed -r ‘s,.*id=([0-9]+).*,1,’)

CRTSTATE=$(xinput list-props $DEVID|grep “Device Enabled”|sed -r ‘s,.*([0-1]),1,’)

echo “Toggle touchpad to new state: $NEWSTATE”

xinput set-int-prop $DEVID “Device Enabled” 8 $NEWSTATE

Leave a Reply