Stop Touchpad

I like stoping the touchpad when using laptop bacause my hands may sometimes touch it and the mouse pointer will go somewhere not expected. However, it’s not easy to stop touchpad with GUI on CentOS(not like Fedora, we can stop it in System Settings of Mouse).

Lots of articles tell me to modify the xorg.conf file, and then use the command $synclient TouchpadOff=1/synclient TouchpadOff=0 to stop or start touchpad, but it is not universal for all platforms. Finally, I found a perfect solution and guide me implement it.

INSTALL

Install xinput
$sudo yum install xorg-x11-apps

SOLUTION

1.Look for the pointer id of touchpad
$xinput –list

The output will like this(pic):

2.We find this record: SynPS/2 Synaptics TouchPad id=14. It indicates my touchpad id is 14.

3.Stop or start it:
stop: $xinput set-int-prop 14 “Device Enabled” 8 0
start: $xinput set-int-prop 14 “Device Enabled” 8 1

ALSO

1.Use the script. Starting or stoping it with command everytime will let me crazy. Thus, we can use the script.The content below:

#########################################################################

File Name: Touchpad.sh

Author: Your_Name

mail: Your_Email

Created Time: Your_Create_Time

#########################################################################

#!/bin/bash

#echo “i.e. type command ‘touchpad on’ will TURN ON Touchpad”

if [ $1 == ‘on’ ]
then
xinput set-int-prop 14 “Device Enabled” 8 1
echo “Touchpad On”;
elif [ $1 == ‘off’ ]
then
xinput set-int-prop 14 “Device Enabled” 8 0
echo “Touchpad Off”;
else
echo “Parameter: on/off”;
fi

######################End####Of#####File#################################

I suppose you named the sh file as /opt/commands/Touchpad.sh.

2.Modify the mode and execute it.
$sudo chmod 755 /opt/commands/Touchpad.sh

You now can start or stop touchpad with the command:
start:$/opt/commands/Touchpad.sh on
stop:$/opt/commands/Touchpad.sh off

3.Startup. You also can add the sh file to the startup list of the system. If so, the touchpad will stop as the system start and that’s what I want. We can add a command to the /etc/rc.local, which is the last one to be loaded by system and the command in it will be executed.
$sudo vim /etc/rc.local

And add this line to the file:/opt/commands/Touchpad.sh off
Then save and quit.

4.Restart your computer.

ORIGINAL ARTICLE(script touchpad): http://www.iewb.net/index.php/qg/4017.html
ORIGINAL ARTICLE(startup list): http://www.cnblogs.com/gzggyy/archive/2012/08/07/2626574.html