Posts Tagged ‘xinput’

Disable touchpad in Linux Mint (part 2)

November 4th, 2010 No comments

Today I find a useful script on Ubuntu forum ( It can check for usb mouse and perform operation to enable/disable touchpad.

Here is the script that I customize for my Linux Mint.

# Toggle touchpad on and off
# Author: Heath Thompson
# Email:
# For startup wait for desktop to load first.
while true
if ps -A | grep gnome-panel > /dev/null;
echo ‘X loaded’
echo ‘X not loaded, waiting…’
sleep 5
# Check to see if appletouch is running
# if lsmod | grep appletouch > /dev/null;
# then
# echo ” * Appletouch enabled”;
# else
# echo ” * Appletouch either not working or not installed”
# killall mouseSwitcher
# fi

while true
# ‘xinput list’ will list all input devices x detects
# I could reference my usb mouse by ID but I’m afraid that if I plug
# another device in before my mouse, it might not have the same ID each
# time. So using the device name makes it relatively fail-safe.
if xinput list ‘Logitech USB Laser Mouse’;
# Found my usb wireless mouse
# Disable everything on the Touchpad and turn it off
#synclient TouchpadOff=1 MaxTapTime=0 ClickFinger1=0 ClickFinger2=0 ClickFinger3=0;
# Ends all syndaemon capturing which may have been used to monitor the touchpad/keyboard activity
#killall syndaemon

# custom for asus f8p
xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 0
# My usb wireless mouse isn’t present we need the touchpad
# Reenable Touchpad and configure pad-clicks
# RTCornerButton is the Right Top Corner on the touchpad
# The value 3 maps it as the right click button
# RBCornerButton is the Right Bottom Corner on the touchpad
# The value 2 maps it as the middle click button
#synclient TouchpadOff=0 MaxTapTime=150 ClickFinger1=1 ClickFinger2=2 ClickFinger3=3 RTCornerButton=3 RBCornerButton=2;
# Forces break of touchpad functions while typing if the touchpad is enabled.
# Adds a 3 second interval following keyboard use which helps to prevent the
# mouse from jumping while typing & resting hands on restpad or the touchpad
#syndaemon -i 3 -d;

# custom for asus f8p
xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 1

# wait 2 seconds and poll the mouse state again
sleep 2

sleep 15

Its main task is to check the existence of a given mouse. If the mouse exists, it will disable touchpad by using xinput command. If not, it will enable touchpad. That’s simply.

Below is where you need to customize for your own machine.

1. Use xinput to get the name of your usb mouse, and replace ‘Logitech USB Laser Mouse’.

if xinput list ‘Logitech USB Laser Mouse’;

2. Use xinput to get the name of your touchpad device, and replace “SynPS/2 Synaptics TouchPad”.

xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 0

xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 1

3. Save your script somewhere (I put in my home directory). Mark it executable.

4. Run the script and test it: plug on/off your usb mouse. If test works, do last step.

5. Go to Startup Applications, add this script.

You will no longer worry about discomfort with the touchpad. It works perfectly like a feature of Synaptics utility for Asus laptop.

Disable touchpad in Linux Mint

November 2nd, 2010 3 comments

Laptop users often have this desire: disable touchpad when usb mouse is connected to machine. For Windows, we can do this by installing Synaptics utility, then turning on the right feature. For Linux Mint / Ubuntu, there are tools to do so but that may not work stably all the time. I try GPointing Device, the touchpad is suddenly turned ON after a while I turn it OFF. That’s really headache when you work with your laptop for hours.

Some solution refers to modifying /etc/X11/xorg.conf but this file does not exist in Linux Mint 9, even if I add it and use synclient command, this way dooes not work for me.

Finally I find out a useful command, xinput, which can totally disable touchpad in a session. If you’re in same situation like me and looking for a solution that works, read on. If you’d like to learn more, read this Ubuntu wiki:

First, list all current input devices.

administrator@linuxmint ~ $ xinput list
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB Laser Mouse                    id=10    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                  id=12    [slave  pointer  (2)]
⎜   ↳ Macintosh mouse button emulation            id=13    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
↳ Power Button                                id=6    [slave  keyboard (3)]
↳ Video Bus                                   id=7    [slave  keyboard (3)]
↳ Sleep Button                                id=8    [slave  keyboard (3)]
↳ USB 2.0 Camera                              id=9    [slave  keyboard (3)]
↳ AT Translated Set 2 keyboard                id=11    [slave  keyboard (3)]
↳ Asus Laptop extra buttons                   id=14    [slave  keyboard (3)]

List properties of specific device.

administrator@linuxmint ~ $ xinput list-props “SynPS/2 Synaptics TouchPad”
Device ‘SynPS/2 Synaptics TouchPad’:
Device Enabled (140):    0
Device Accel Profile (257):    0
Device Accel Constant Deceleration (258):    1.000000
Device Accel Adaptive Deceleration (260):    1.000000

Set property “Device Enabled” to 0 to disable the device.

administrator@linuxmint ~ $ xinput set-prop “SynPS/2 Synaptics TouchPad” “Device Enabled” 0

It works instantly without restarting :D . You can save the last command line as a an executable script, put it on Desktop, click whenever you want.

Now you feel better  yet? Or still don’t like to type command line? Then this wiki may be helpful There is section about how to disable touchpad that really works.