# Solved: Deactivating Touchpad in Kibuntu



## wladicus (Aug 25, 2008)

Last month (Aug/2008) I discovered how to deactivate the touchpad on my MDG Visionbook laptop when I have a wheel mouse plugged into a USB port. This was in the Windows Vista OS. The solution was to download a driver for the Synaptics touchpad which has a disable function that works even though the laptop does not have a Synaptics touchpad.
I have loaded a Wubi version of Kibuntu on my laptop so that there was no need to make a physical disk partition (since I do not have disks for a Windows OS reload). The Linux system works really well and I am experimenting with Linux for the very first time.
My question for those with good Linux experience: is there some sort of mouse driver for the Linux environment that will permit the deactivation of the laptop touchpad? Thank you in advance for considering my question


----------



## lotuseclat79 (Sep 12, 2003)

Hi wladicus,

Maybe this will help: How To: Disabling your Touchpad while typing.

-- Tom


----------



## wladicus (Aug 25, 2008)

Hi Tom,
Thank you for your reply. I read How To: Disabling your Touchpad while typing but it is quite confusing to me.
1. Is there a Synaptic driver for Linux for free download? I could not find one in the past - only for Windows. If there is a driver, do I need to install it and where do I find this driver?
2. Do I have to install both synclient and syndaemon, or just syndaemon? Where do I find this download? Or is it built into the Synaptic Driver, in which case, how do I activate it?
It would be nice if Chantra, who wrote the article and discovered how to deactivate the touchpad could write an automated installer that does everything that needs to be done to help guys like me who just want things to work a certain way and hopefully someone with the knowhow can do it for us rather simply.
Thank you for sending me this 'possible' solution. I hope you can help me out further.
Walt


----------



## lotuseclat79 (Sep 12, 2003)

Hi Walt,

Try this: Disable Synaptics Touchpad.

-- Tom


----------



## wladicus (Aug 25, 2008)

Thank you again Tom for your further assistance. As I stated in my original post, my laptop DOES NOT HAVE a Synaptics touchpad, but I downloaded a Synaptics driver in my Windows environment and it worked very well to disable the touchpad.
Now my question regards how I can do this in Linux since Synaptics does not have a driver for Linux OS. I only found drivers for Windows. Both solutions that you posted mention a 'syndaemon' and 'synclient'. Are these part of a symantics driver for the touchpad? If so, from where can I download such a driver? Or if it is already a part of Kubuntu then how do I access/activate what I need? ... I re-read the suggested info and ... I think (see added note below).
------------------------------------------------------------------------------------------------------------------
I finally, somehow, downloaded gsynclient and modified xorg.conf as suggested, then rebooted, and when I enter $synclient TouchpadOff=1 as root I get the error message -> TouchpadOff=1: command not found
I am a real novice at all of this, so I may be quite ignorant of what I am doing. Please help if you know I am doing something incorrectly. Still looking for the right way to do things. It probaly does not work because my Laptop does NOT have a Synaptics Touchpad.
------------------------------------------------------------------------------------------------------------------
Sorry if my original post was not clear enough. Thank you for your help.
Walt


----------



## wladicus (Aug 25, 2008)

I guess either there are not many interested in this topic or else not enough knowledge base to tackle the problem. I've tried everything I could as a pure novice, even suggestions from a couple of other forums. It seems that there is the odd person (even with a lot of experience) who has come upon this same problem, and no one seems able to come up with a definitive solution. 
All the solutions that have been provided thus far, at least from the few forums that I have visited, work only selectively in some cases, but are by no means universal in scope. That touchpad sure does create some offenses as it constantly seems to pick up activity from hovering thumbs, fingers and general hand motions.
I will still check occasionally, maybe someone will have a 'BRAINSTORM' and uncover the right solution for my and a few other persons' needs. Thank you for your ongoing support.
Walt


----------



## wladicus (Aug 25, 2008)

_**** **SOLVED FINALLY** ****_
From a terminal enter the following code:
To disable the Touchpad -


> sudo rmmod psmouse


To re-enable a disabled Touchpad -


> sudo modprobe psmouse


I suppose this can be automated in a file somehow or even attached to a function key probably if someone has the knowhow.
I received this solution from the following link:

*http://ubuntuforums.org/showpost.php?p=5694509&postcount=13 *


----------



## wladicus (Aug 25, 2008)

*KUBUNTU: HOW TO TURN THE TOUCHPAD OFF AND ON WITH ONE Shortcut KEY*
I did a post earlier on at http://ubuntuforums.org/showthread.php?t=914537&page=2 where I submitted what I had discovered about turning the touchpad off and on. 


> sudo rmmod psmouse -----> Turns the touchpad OFF
> sudo modprobe psmouse ---> Turns the touchpad ON


​ But I still desired to do this with a shortcut key instead of terminal input. Then I found a method of doing this at:
https://help.ubuntu.com/community/SynapticsTouchpad/ShortcutKey
but nothing worked in my Kubuntu environment for whatever reason. Neither synclient nor syndaemon worked, nor did gsynaptic, ksynaptic, or qsynaptic. Furthermore even bindkeys and bindkeys-config refused to function at all.

Therefore, facing all these 'downers' I set out to find another method using the code that did work in my system, on my MDG VisionBook laptop. It has a FnF3 key that is supposed to turn the touchpad off and on (according to the manual) but it never did work! I have often wondered if it was ever meant to work and is just there as a decoration gadget? Anyway, knowing that rmmod psmouse and modprobe psmouse worked to turn the touchpad off and on, I worked out the following method for setting up a shortcut key to turn the touchpad off or on with a single key press.

So here it is. It works for me and I hope it works for you also if you need it. 
----------------------------------------------------------------------------
*STEP 1*
Using a text editor create a flag file called tpon in the /usr/local/bin folder. It does not matter if the file is empty or has a comment line in it as mine does (shown below)-the file acts as a flag to tell the touchpad.py program script (below) the current state of the touchpad.*
*** Create Flag File tpon ****

```
# touchpad flag file
```

=====================================================================================================
*STEP 2*
 Contents of Executalble File: touchpad.py (make executable with chmod 755 touchpad.py) You can simply cut and paste the code below, starting with '#!/bin/bash' down to 'exit 0'.

```
[FONT=Courier New][SIZE=2]#!/bin/bash
file1="/usr/local/bin/tpon"  # tpon is the flag file when the touchpad isactive
file2="/usr/local/bin/tpoff" # tpoff - the flag file with deactivated toucpad
if [ ! -e "$file2" ]         # check for NON-existence of 'tpoff' flag file
    then                     # if tpoff is NOT found then touchpad is ON
  rmmod psmouse              # so turn the touchpad OFF
  mv $file1 $file2           # rename the flag file to 'tpoff' to reflect state
 else                        # tpoff flag file EXISTS so      touchpad is OFF
  modprobe psmouse           # so turn the touchpad ON
  mv $file2 $file1           # rename the flag file to 'tpon' to reflect state
fi                           # end of conditional code for touchpad state
exit 0                       # Leave the program with a zero return code.[/SIZE][/FONT]
```
*
STEP 3*
Make the above file (touchpad.py) executable by entering, in a terminal as root, the code: *chmod 755 touchpad.py *
--------------------------------------------------------------------------------
*STEP 4*
Set up the Key or Key combination of your choice to run the touchpad.py script file. I have chosen the F3 key so the following text will specify F3 but you can set it to whatever you prefer.

The F3 key or any key you choose activates the touchpad.py file shown above.

The first time the F3 key is pressed, the touchpad turns off and the next time it is pressed the touchpad is turned on. This continues in an alternating pattern.

When you log onto the system the next time, the TouchPad will be activated during system logon but after you log on pressing the F3 key will alternately deactivate and activate the TouchPad. 
-----------------------------------------------------------------------------------
_*HOW TO SET UP THE KEY TO TURN THE TOUCHPAD OFF or ON*_
1) Bring up the Desktop Menu and right-click anywhere on the menu that has an arrow at the right side (indicating submenus). [If you click on an item without further submenus then a small box with three choices will "pop up". The second choice will be to "Edit Item" but clicking on an item with submenus will have only two choices in the pop-up box and the second choice will be "Edit Menu". That is the one we need]. 
 2) So now you have the pop-up box with only two choices. The second item displayed is "Edit Menu". 
 3) Left-click on this second item. The KDE Menu Editor will come up. If it is hidden behind the existing menu (as it always is in my case) then simply click your mouse pointer on the KDE Menu Editor and it will become the menu of focus. 
 4) In the existing list of menu items CLICK on or highlight the submenu where you wish the 'hide' this touchpad application. I chose the 'Utilities' submenu item. (Since we are going to activate this 'switch' application with a keyboard key, we do not really have to have it readily accessible in the menu. But we have to put it somewhere in this menu to be able to use the 'key setting' ability that it provides for launching the application. 
 5) Now click the [File] menu item at the top and select [New Item]. In the small window that pops up enter the name you wish to call this application. I named it [TouchPad Off/On Switch]. After naming the application click on [OK]. This will place the name you just typed into the submenu you just selected (which, as I said, in my case, was in the 'Utilities' submenu). 
6) Now hilite (click on) the application name that you just placed in your submenu of choice and you will see on the right-hand side of the KDE Menu Editor window "Name: -the name you chose is entered in the box-". Go Down 3 boxes to the one entitled "Command". Click on this box and enter the following code: 

```
[FONT=Arial]sudo touchpad.py[/FONT]
```
  7) Go down the the item that says "Run in terminal" and place a checkmark (click) in the box in front of "Run in terminal". Every time you press the short-cut key you will see the terminal briefly flash in and out of view. This visibly indicates that the application is being launched by the terminal command "sudo touchpad.py".
 8) The last item at the bottom of the window is "Current shortcut key". This item will enable us to set a shortcut key to launch the touchpad switch application. In the box next to "Current shortcut key" it probably says [None]. Click on this box and in the ensuing pop-up screen next to the word "Shortcut:" you should see an empty box. Now press the key or key combination of your choice and you should see it appear inside this box. If your key choice has already been allocated then you will see a Conflict window pop up. If you still wish to use your chosen key combination then click on [Reassign]. Now the previous KDE Menu Editor window will be in focus with the box at the bottom right showing your key selection. 
9) Click on the diskette 'save' icon or [File][Save] to save your key choice. Wait for the save action to complete (about 1 second) then exit the KDE Menu Editor. 
=========================================================================================
The touchpad switch application is now prepared for launching with your chosen keyboard key or key combination. 
But first we must do 3 more things to make this all work. 
-------------------------------------------------------------------------------
*STEP 5*
Edit your sudoers file to allow you to execute the script without a password. 



> Edit using ----> *sudo visudo* ... or use ----> *sudo nano sudoers*


 Near the end of the sudoers file you will see a section of code similar to the following: 

```
# User privilege specification
root    ALL=(ALL) ALL 

# Members of the admin group may gain root privileges
%Admin ALL=(ALL) ALL
```

Copy & paste the following code to the end of the above segment of code into the sudoers file: 

```
[B][COLOR=Red]{user}[/COLOR][/B]  ALL=NOPASSWD: /usr/local/bin/touchpad.py
```
*
NOTE: *Make sure to replace *{user}* with _*your own login user name*_
----------------------------------------------------------------------------------------------------------------

*STEP 6* 
Everytime you restart the computer the touchpad will be active (ON). Because you may have exited Linux with the touchpad OFF, the tpoff flag file will have been left in the /usr/local/bin folder. Thus the first press of the shortcut key would would turn send the command to turn the touchpad ON (when the touchpad is already on) and the tpoff file would be renamed to tpon. The second press of the shortcut key would then turn off the touchpad since the correct flag file (tpon) would now be in existence. 
*IF YOU DO NOT MIND THE EXTRA KEY PRESS then you are now DONE! *- otherwise - continue...

The solution to this extra key press at startup is to begin each bootup with a known state of the touchpad. That is to say that the touchpad will be ON after a bootup, but the flag file may be *tpoff* instead of *tpon*. In the above explanation I pointed out that pressing the shortcut key the first time will cause the code to turn the touchpad ON (modprobe psmouse) to be executed and thus the touchpad will still be on, but the flag file will now have been changed from tpoff to tpon so that the flag file is in agreement with the state of the touchpad. From that point on each key press will change the state from off to on in an alternating fashion. This result can be achieved automatically by having a small script execute automatically at startup.

To do this you require the KDE Control Centre to be installed if it is not already installed.
You can install the package from a terminal with


> apt-get install kcontrol


-------------------------------------------------------------------------------------------------------------------------

*[a]- Write a script called .... set-tpon.sh *

The script *set-tpon.sh *will be started automatically. 
This script will ensure that the flag file is named tpon at every session startup. 
If the file left in the */usr/local/bin* folder is *tpoff* then it will be changed to *tpon* . 
If it is already named *tpon* then nothing will be done. 
Put the following script (named *set-tpon.sh*) into the */usr/local/bin* folder. 

```
#!/bash/bin
file1="/usr/local/bin/tpon"
file2="/usr/local/bin/tpoff"
   if [ -e "$file2" ]
      then
   mv $file2 $file1
fi
exit 0
```
After saving the above script file make it executable with the code: *chmod 755 set-tpon.sh*

-now continue with step * below:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**  - To set up the autostart of the script file, do the following:

 1) Start up KDE Control Centre. 
 2) Select KDE Components from the menu list. 
 3) Click on Autostart Manager. 
 4) On the window that appears next click the [Add] button.
 5) On the screen that pops up enter in the window the following code:


Code:


[B]/usr/local/bin/set-tpon.sh[/B]

 
 6) Check (click) on the box next to "Run in terminal" 
 7) On the next window that appears click on the Permissions tab. Check (click) the box next to "Is executable". 
 8) Click on OK. 
 9) Click on Apply and exit KDEControlCenter. 
=============================================================================
STEP 7
Reboot your system. ​ ==============================================================================
Now you can turn your touchpad off and on by pressing the key or key combination that you selected (in my case it is F3). If anyone finds improvements to the above, I would be happy to learn about them. (Please remember that I am a neophyte with only one month of experience with Linux and this is the best I could do on the fly at this time with what I know). 

walt 
2008.09.19 *


----------



## wladicus (Aug 25, 2008)

First line of code in Step 6 [a] should be

```
#!/bin/bash
```
Sorry, typo...


----------



## wladicus (Aug 25, 2008)

Several Forum viewers have provided me with some great comments on how to improve the coding for switching the Touchpad off/on. Currently I am using a flag file to track the touchpad state (Off or ON - tpoff , tpon). This came about because I was familiar with using this methodology in the past and am very new to Linux, so therefore do not really know the various coding possibilities that are available to knowledgable programmers.

Now, with so many great comments from programmers much more experienced than I am in Linux, I have actually used tried all of the suggestions on my own laptop and will be ready soon to post the latest updated, more efficient version of the Touchpad Switch programme.

Thank you for visiting my thread.


----------



## wladicus (Aug 25, 2008)

Click on the following link for much improved TouchPad switching code:


> http://www.techsupportteam.org/foru...g-laptop-touchpad-off-different-approach.html


----------



## wladicus (Aug 25, 2008)

The Complete Tutorial is also posted at the following link:



> http://www.pchwforum.com/Kubuntu-Turning-Laptop-Touchpad-Off-on-A-Different-Approach-t2572.html


----------

