Logo
IT Dienstleistungen

tp - touchpad tapping switch

Did you ever got freaked by that damn touchpad? Well, I like the use of tapping onto it to click when just surfing the web or playing simple games like mahjongg, but I get angry and mad if I had to write some lines of text and the cursor constantly jumps into another line. That happens, because my meaty-thumbs just slightly touches the touchpad when writing 10-finger like.

To end my pain I wrote this small script and call it with a key-combo when needed (My Dell Mini 9 did not have any key to deactivate the touchpad as whole, that was my solution on the Toshiba Laptop).

Every time you use it, a nice D-Bus message pops out to notify you on your desktop.

dependencies

need synclient, should be in any libsynaptic package

Usage

Just copy it into a file within your path (maybe ~/bin/tp.sh could be a good place) and it executable with chmod +x ~/bin/tp.sh

Call tp.sh to detect the actual tapping state and switch it, or in other scripts with a needed result with tp.sh [on|off] to set the mode directly.

The last step is to define a key, in KDE4 it could be done in systemsettings, I picked my original „Battery Info“ key (after some slight configuration) and it works perfect now.

Remember: You need
Option       "SHMConfig" "on"          

in the touchpad-device section of your /etc/X11/xorg.conf for every „on-the-fly“ change to your touchpad.

Source

#!/bin/bash             
# small tool to en/disable the synaptic touchpad
# (c) 2009 Manuel Krischer                      
#                                               
# call this script with no parameters will switch the current state
# on|off will set the state for tapping (usefull in other scripts) 
#                                                                  
 
#first we set the original values
#check with "synclient -l | grep MaxTapTime" for your notebook original setting
#BEFORE using this tool (or after reboot)    
 
#DEFAULT is 180 (from Dell Mini 9 Netbook)
TAPTIMEORIG=180                           
#Should be zero                           
TAPTIMEOFF=0                              
 
#now we grab the actual settings
TAPTIMENOW=$(synclient -l | grep MaxTapTime | cut -c 31-)
echo "*****************************************"         
echo TP - switch tapping on synaptic touchpads           
echo "*****************************************"         
echo "actual TapTime was $TAPTIMENOW"                    
 
 
#decide tapping status
if [[ $TAPTIMENOW = 0 && $1 = "" ]]; then
        echo -e "Seems like your tapping is OFF."
        synclient MaxTapTime=$TAPTIMEORIG        
        TAPTIMENOW=$(synclient -l | grep MaxTapTime | cut -c 31-)
        echo "actual TapTime is now $TAPTIMENOW"                 
        echo -e "Tapping is now \033[01;32mON\033[00m."          
        notify-send "TP - Touchpad modifier" "Touchpad tapping switched ON." --icon=/usr/share/icons/oxygen/48x48/devices/input-tablet.png  --expire-time=3000                                                                                            
        #kdialog --passivepopup "Touchpad tapping now ON." 2 --title "TP - Touchpad modifier"                                
 
elif [[ $TAPTIMENOW > 0 && $1 = "" ]]; then
        echo -e "Seems like your tapping is ON."
        synclient MaxTapTime=$TAPTIMEOFF        
        TAPTIMENOW=$(synclient -l | grep MaxTapTime | cut -c 31-)
        echo "actual TapTime is now $TAPTIMENOW"                 
        echo -e "Tapping is \033[01;31mOFF\033[00m."             
        notify-send "TP - Touchpad modifier" "Touchpad tapping switched OFF." --icon=/usr/share/icons/oxygen/48x48/devices/input-tablet.png  --expire-time=3000                                                                                           
        #kdialog --passivepopup "Touchpad tapping now OFF." 2 --title "TP - Touchpad modifier"                               
 
elif [[ $1 = "on" ]]; then
        echo "trying to enable tapping..."
        synclient MaxTapTime=$TAPTIMEORIG 
        TAPTIMENOW=$(synclient -l | grep MaxTapTime | cut -c 31-)
        echo "actual TapTime is now $TAPTIMENOW"
        echo -e "Tapping is now \033[01;32mON\033[00m."
        notify-send "TP - Touchpad modifier" "Touchpad tapping set to ON." --icon=/usr/share/icons/oxygen/48x48/devices/input-tablet.png  --expire-time=3000
        #kdialog --passivepopup "Touchpad tapping now ON." 2 --title "TP - Touchpad modifier"
 
elif [[ $1 = "off" ]]; then
        echo "trying to disable tapping..."
        synclient MaxTapTime=$TAPTIMEOFF
        TAPTIMENOW=$(synclient -l | grep MaxTapTime | cut -c 31-)
        echo "actual TapTime is now $TAPTIMENOW"
        echo -e "Tapping is \033[01;31mOFF\033[00m."
        notify-send "TP - Touchpad modifier" "Touchpad tapping set to OFF." --icon=/usr/share/icons/oxygen/48x48/devices/input-tablet.png  --expire-time=3000
        #kdialog --passivepopup "Touchpad tapping now OFF." 2 --title "TP - Touchpad modifier"
 
elif [[ $1 = "-h" || $1 = "--help" ]]; then
        echo -e "\tTP - switch the tapping status of your touchpad"
        echo -e "\t$0 without arguments swaps the current status"
        echo -e "\t$0 [on|off] sets a desired status of the touchpad"
        echo -e "\tdepends on 'synclient' from the libsynaptic package"
 
else
        echo "$0 -h for help"
 
fi
echo -e "\n\n"

Seiten-Werkzeuge