Powered By

Powered by Blogger

Minggu, 29 November 2009

Ubuntu: Automatically Disable TouchPad While Typing

syndaemon is a program that monitors keyboard activity and disables the touchpad when the keyboard is being used. If you are using Ubuntu / Debian, syndaemon should already be installed and all you have to do is type this in a terminal to start it as a daemon:
syndaemon -d

To set the time you want syndaemon to restore your keyboard, run this command:
syndaemon -i 4 -d


Where "4" is the time between the period you stopped typing and when the touchpad becomes active.

Please note that I have noticed you need to kill syndaemon before changing it's settings. So before specifying an option, kill it with:
killall syndaemon


You can also specify syndaemon to only deactivate scrolling and tapping but leave your mouse pointer active even if you type on your keyboard, by ysing the "-t" option.

To see everything syndaemon can do, use the man command:
man syndaemon


The following example invokes syndaemon for 4 seconds after any keyboard activity (-i 4), except when modifier keys such as Alt or Shift are used (-K), and only disables tapping and scrolling (-t) for this period:

syndaemon -i 4 -d -t -K


And a bonus. A bash script to toggle the touchpad on an off with a hotkey:

# toggle synaptic touchpad on/off

# get current state
SYNSTATE=$(synclient -l | grep TouchpadOff | awk '{ print $3 }')

# change to other state
if [ $SYNSTATE = 0 ]; then
synclient touchpadoff=1
elif [ $SYNSTATE = 1 ]; then
synclient touchpadoff=0
else
echo "Couldn't get touchpad status from synclient"
exit 1
fi
exit 0


Save it in a file and call it whatever you want (for instance "toggle_touchpad.sh"), make the script executable (chmod +x toggle_touchpad.sh) and assign a hotkey for it (for instance by using CompizConfig Settings Manager, on the Commands options).

Note: If you use an EeePC, you can toggle the TouchPad on and off with an utility called EeePC Tray or with Eee Control (see step 9)

Tidak ada komentar:

Posting Komentar