How-to disable Touchpad on Linux

17 11 2007

Disable Touchpad on Fedora 7 - coded by Shailen Sobhee

This method had been tested on Fedora 7, but I suppose that it should also work on other widely supported Linux’es like Red Had Enterprise, Suse, Mandrake.

 

The touchpad is indeed a useful tool but sometimes it can be inadvertently irritating. I haven’t figured out why laptop designers haven’t considered this problem and placed the touchpad a bit further away or re-engineered it such that when the keyboard is in use,the touchpad is momentarily turned off.

In any case, last week was almost the last drop out that overflowed the pot. I was busy having an interesting conversation with my girlfriend and all the time, the cursor would jump off Pidgin(a chat client that supports various protocols,including googletalk and msn).

I decided to search the net for a means to disable the touchpad when linux detects a mouse and found one method but didn’t work. In addition, the tutorial was for the old FC4 and probably didn’t support F7 anymore. However, I love Fedora too much to reboot into windows and chat on MSN there, with the synaptics touchpad driver for windows disabled.

This is the simplest workaround for this problem, so without digressing too much from you attention, here you are:

Step1:

Edit your Xorg.conf file.

su
vi /etc/X11/xorg.conf

Look for the “InputDevice” Section and add the line below before “End Section”. To enter in edit mode, type the letter ‘i’. You should see –INSERT in bold at the bottom of the terminal. To save and quit, hold Shift+ZZ

Option "SHMConfig" "on"

On my laptop, it looks like this: (Yours may be slightly different, but the major parts, like Driver “synaptics” are the same.)

Section “InputDevice”
Identifier “Synaptics”
Driver “synaptics”
Option “Device” “/dev/input/mice”
Option “Protocol” “auto-dev”
Option “Emulate3Buttons” “yes”
Option “SHMConfig” “on”
EndSection

Now, please be careful. WordPress has a relatively poor article-edit interface, so you can’t manage your text properly. Notice the quotes (“) on the words: “SHMConfig” “on” .Just don’t copy paste that line there. Ensure that the quotes are the same as the quotes on the other words. Linux requires that the quotes are the same. If you happen to paste that line in the xorg.conf file, check carefully that the quotes do not look different from others. However, if you are typing the line there, type it exactly as it appears here, as linux is case-sensitive.

Step2:

Download the touchpad scripts I have coded.

Copy the touchpad.tar.gz file in a folder, cd into the folder (Ex: cd /home/your_name/Desktop/) and extract the scripts:

tar -xzf touchpad.tar.gz

Step3:
Copy the file touchpad in the filesystem directory. To do that, go into the directory you have just extracted the script and,

cp -apv touchpad /

Step4:

Bookmark/save/print this page and reboot your computer. This is the best method to reload X. However, you can still restart X from the console, but I don’t recommend this.

Step5:

When you come back to your computer, you can disable the touchpad by issuing the command below. However, before you can do this, you have to set executable properties to the script. This can be done by issuing :

chmod +x /touchpad

Then to disable the touchpad,

/touchpad stop

To start it again, simply type:

/touchpad start

The status function is an added feature I have included for step5, but it is obviously not needed here, because you can test it trying the touchpad.

Step6: (RPM based machines only like Fedora, RedHat Enterprise..but can be re-engineered for Ubuntu)

You have actually succeeded in deploying the scripts. However, if it is a tedious task to always disable the touchpad each time you boot, you can use my second script called touchpadboot. Again, go into the folder you have extracted the scripts.
su
cp -apv /touchpadboot /etc/init.d/touchpadboot
chmod +x /etc/init.d/touchpadboot
/sbin/chkconfig --add /etc/init.d/touchpadboot

Note: There are two hyphens before the command add, after chkconfig. (/sbin/chkconfig – -add … (there is no space between the hyphens though). WordPress tends to obfuscate text, and it is an incredible feat to post a neat, well formatted blog text. I wonder what tool the wordpress engineers use to post their articles-it is definitely not the common online wordpress editor or else they would know their editor is ludicrously weak.

Step7:

That’s it, your computer will always start with touchpad disabled. Note that it will hence be mandatory to move around with your mouse. You can still enable the touchpad by issuing the ‘/touchpad start’ command. I will recommend to set a shortcut key to launch a terminal (Fedora7: System>Preferences>Personal>Keyboard Shortcuts).

Updates: 01 March 2008 : Updated the touchpad scripts.
Added a note about pasting code in the xorg.conf file, regarding quotes.
Changed the article a little for beginners to understand.
Tested scripts on Fedora 8 – Works perfectly.

Thanks Hsieg , Jso, Joe Rogers and James Redpath for pointing out the bugs i’ve left in the old article.