Home > Máy tính > Disable touchpad in Linux Mint (part 2)

Disable touchpad in Linux Mint (part 2)

November 4th, 2010 Leave a comment Go to comments

Today I find a useful script on Ubuntu forum (http://ubuntuforums.org/showthread.php?t=1004591). It can check for usb mouse and perform operation to enable/disable touchpad.

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

#!/bin/bash
#
# Toggle touchpad on and off
#
# Author: Heath Thompson
# Email: Heath.Thompson@gmail.com
#
# For startup wait for desktop to load first.
while true
do
if ps -A | grep gnome-panel > /dev/null;
then
echo ‘X loaded’
break;
else
echo ‘X not loaded, waiting…’
sleep 5
fi
done
#
# 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
do
# ‘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’;
then
# 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
else
# 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
fi

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

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.

  1. No comments yet.
  1. No trackbacks yet.