martes, 9 de septiembre de 2008

activate/deactivate Touchpad on linux

I think I already wrote this some time ago but I think is enough interesting to repeat the explanation.
So, for all the people who has a laptop and, as they're typing their hand touches the touch-pad and moves the pointer to any place on the screen, making them start writing on another place.Too uncomfortable!

So, it must be edited the file /etc/X11/xorg.conf as root and change the following things:

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
#Deactivate this:
#InputDevice "Mouse0" "CorePointer"
#And write the next:
InputDevice "TouchPad" "CorePointer"
EndSection


Now, we have to add the following text to let xorg knows we're using a touch-pad


Section "InputDevice"
Identifier "TouchPad"
Driver "synaptics"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "SHMConfig" "on"
Option "Emulate3Buttons" "yes"
Option "CorePointer"
EndSection



And also, we must comment the lines about the original configuration about mouse:

#Section "InputDevice"
# generated from default
# Identifier "Mouse0"
# Driver "mouse"
# Option "Protocol" "auto"
# Option "Device" "/dev/psaux"
# Option "Emulate3Buttons" "no"
# Option "ZAxisMapping" "4 5"
#EndSection



Now, we can use
synclient
, a program that can modify parameters of the touchpad on the fly, without restarting the xorg ;)

$ synclient -l
will show all the parameters of the touchpad
TouchpadOff
Is the option that shows if the touchpad is working or not so, we can do a script like that:

if synclient -l | grep "TouchpadOff = 0" > /dev/null
then synclient TouchpadOff=1
else synclient TouchpadOff=0
fi


Only configure one key of your keyboard to run this script ;)

P.S: There's some computers that has practical key so, once the xorg configuration file has being set up, the key works:D

No hay comentarios: