Disabling the touchpad on your laptop in Linux

To disable the touchpad on your Linux machine (Ubuntu used in the example), run xinput list

$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ PixArt HP X500 USB Optical Mouse        	id=9	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]

Find the id of your touchpad and replace it in the following command to disable it. (In the example, my touchpad’s ID is 12)

$ xinput set-prop 12 "Device Enabled" 0

To re-enable the device,

$ xinput set-prop 12 "Device Enabled" 1

But doing this often can be cumbersome, hence I have added the following in my ~/.bash_aliases to have shortcuts for disabing and re-enabling the touchpad:

alias disable-touchpad='xinput set-prop `xinput list | grep -i touchpad | cut -f 2 | grep -oE '[[:digit:]]+'` "Device Enabled" 0'
alias enable-touchpad='xinput set-prop `xinput list | grep -i touchpad | cut -f 2 | grep -oE '[[:digit:]]+'` "Device Enabled" 1'

With this, you can disable and re-enable the touchpad using the disable-touchpad and enable-touchpad commands.

So, if you like it, feel free to add them to your ~/.bash_aliases as well. Good riddance from accidental clicking!

This article was originally written for 2buntu.com


Share on