Wednesday, September 18, 2013

Touch pad deactivation while typing and palm detection


I was having the same issue with my ASUS K55A touch-pad has the same issue whether under Arch Linux, or Ubuntu, and I imagine this applies to a lot of other touch-pads out there.  I'm running Openbox in Arch and Semplice (Debian Sid)  Mate in Ubuntu, but this should work for enlightenment, Gnome or any other desktop you might use. 

Set up palm detection:

Turn on palm detection, in a terminal type:
$ synclient PalmDetect=1

Set the maximum width that should be interpreted as a finger instead of a palm.  I choose 4, most how-tos use 10, it's good to do a bit of guess and test here:
$ synclient PalmMinWidth=4
 
Then, set the minimum height of a palm vs a finger:
$ synclient PalmMinZ=50 

Finally, under Ubuntu, 3 finger middle click is not enabled by default, so if you want to enable it use:
$ synclient TapButton2=3 TapButton3=2

In theory, this should enable 2 finger tap for middle click, and 3 finger tap for right click, but in Ubuntu 13.04 the resulting behavior is exactly the opposite.  Therefore, if you prefer 2 finger tap for middle click use:
$ synclient TapButton2=2 TapButton3=3 

To make this permanent once you have found the correct settings, save them into 50-synaptics.conf which is located at /usr/share/X11/xorg.conf.d/50-synaptics.confin  Debian/Ubuntu (Semplice) and at /etc/X11/xorg.conf.d/50-synaptics.conf in Arch Linux based distros, (the first "InputClass" part is for the multi-touch middle click fix, which is already enabled in Arch so you shouldn't need to add it):

Section "InputClass"
    Identifier "touchpad catchall"
    Driver "synaptics"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/event*"
    Option "TapButton1" "1"
    Option "TapButton2" "2"
    Option "TapButton3" "3"
    Option "HorizTwoFingerScroll" "on"
    Option "VertTwoFingerScroll" "on"
EndSection


#synclient PalmDetect=1
Option "PalmDetect" "1"
#synclient PalmMinWidth=4
Option "PalmMinWidth" "4"
#synclient PalmMinZ=50
Option "PalmMinZ" "50"

Actually turning the touch-pad off:

While this solution is almost perfect.  It still really annoyed me that there wasn't a software delay of say a 0.5 second between when the last key-press was registered and when the touch-pad is active.  The Arch linux wiki on touch-pads gives some hints here as well, however, getting it to work was as straight forward as above.  Moreover, when I attempted to run the recommended script, multi-touch gestures were disabled for the remainder of my login session, or in other instances the touch-pad just stopped working all together.

As it turns out, if I run the script before executing the palm detection script then it actually seems to work.  However the script on the arch wiki it's not an ideal example.  A friend of a friend recommended the following instead, and after reading the syndaemon man file I'd have to agree:

$ syndaemon -K -i 0.5 -R -d 

The arch wiki claims that if you save this command to your  ~/.xinitrc file to have it executed automatically at your next log-in.  However when I did this I was unaware that the command must happen before the launch of the desktop (exec DESKTOP.session command).  After playing around with a ton of other config files and learning a ton about the SLiM display manager I finally realized that the command just needed to be moved further up the file as commands after the desktop launch wont be run until the desktop is quit.

I hate touchpads; jummpy zig-zaging pointer/cursor, and disabling the touch pad while typing

I hate touch-pads.  Yes, they have gotten better, especially with muti-touch functionality.  However I really love the GNU/linux middle click to paste highlighted text, and three finger middle click lacks the accuracy one really wants to place a line of text in a specific spot.  The dislike of touch-pads seems to be genetic, father once made his company replace his touch-pad with a trackball (it was modular so it could easily be swapped out), but I digress.

Currently I'm experience 2 different touchpad issues on my ASUS K55A under Ubuntu with Mate and Manjaro / Arch linux with Openbox that seem generic enough to not make a specific blog for my laptop.

Issue 1: Jerky mouse pointer behavior
The first is a really crazy issue where I when to visit the girlfriends family and suddenly my touch-pad was going haywire.  Turns out my the house I as in had lower quality power (probably due to their heavy use of CFL bulbs) and my power adapter was generating EM interference with the touch-pad because of it.  Many forums claim this is due to a faulty power supply, and Dell, Apple, and HP have replaced their afflicted user's adapters.

-- Follow-up: after much testing it's definitely due to power quality issues.  Non-OEM charges continuously replicate this experience.

Issue 2:  Touch pad active while typing, causing accidental clicks and focus changes
This section turned out to be longer than I expected, and I'm still updating it, so it has been moved to a separate post:
http://add4jhf.blogspot.com/2013/09/touch-pad-deactivation-while-typing-and.html