21

Thinkpads (e.g. X230 that I'm using) have both a trackpoint and a touchpad. The touchpad is disabled when typing.

However, when I'm using the trackpoint, I often touch the touchpad as well, and generate mouse clicks I'd like to avoid. Does anyone have an idea how disable mouse-clicks on touchpad when trackpoint is in use?

EDIT: also, can someone explain how the option of disabling touchpad when typing works? What is being done behind the scenes? Is it an xinput configuration command, and if yes, which one?

EDIT2: clarification; manually disabling Touchpad (even with a shortcut) is not the issue here. This should work just like the option "disable touchpad when typing", since I use Touchpad and Trackpoint interchangeably (most frequently, I use Touchpad for scrolling and Trackpoint for moving the cursor).

2
  • This would be interesting. The way the keyboard is laid out contributes to stray gestures interfering with proper operation. I do not think this is possible with current options, but maybe in the future? I find I have to use two hands to type & point, arching my (right) hand tall, to avoid brushing/nudging the trackpad.
    – fleamour
    Aug 29, 2012 at 8:57
  • At the moment, I have disabled mouse clicks with the touchpad - I find that in most cases, I use the buttons on the top of the touch pad anyways.
    – January
    Aug 29, 2012 at 9:15

3 Answers 3

10
+250

Disabling touchpad when keyboard is in use

This function is performed by the syndaemon utility, from the xserver-xorg-input-synaptics package. You can set options such as the idle time, the polling frequency, etc (see runtime help):

Usage: syndaemon [-i idle-time] [-m poll-delay] [-d] [-t] [-k]
  -i How many seconds to wait after the last key press before
     enabling the touchpad. (default is 2.0s)
  -m How many milli-seconds to wait until next poll.
     (default is 200ms)
  ...
  -t Only disable tapping and scrolling, not mouse movements.

Here's the source code for syndaemon.c.

  • The important functions are keyboard_activity(...) and main_loop(...)
  • keyboard_activity uses the XQueryKeyMap API call to get the current state of the keyboard (1 bit per key), and then compares is to the last (old) state; if they are different, it returns 1
  • main_loop polls keyboard_activity every m milliseconds, and based on the "last activity time" and whether keyboard_activity returns true or false, it decides whether to disable or enable the touchpad.
  • The dp_get_device function illustrates how X input devices are enumerated; you should be able to modify this and the keyboard_activity function to also check for any trackpoint activity.

  • The xinput tool lists devices and IDs, for example"

    Virtual core pointer                     id=2    [master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
    ⎜   ↳ SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
    ⎜   ↳ TPPS/2 IBM TrackPoint                     id=12   [slave  pointer  (2)]

  • You can get this (the ID) via the XListInputDevices function

  • After that, you must get a device handle from the ID using the XOpenDevice
  • Then, you use the XQueryDeviceState function to obtain the coordinates of the TrackPoint pointer; similar to the existing loop, you poll this every so often and check if the coordinates have changed (i.e. the TrackPoint is in use), and use that to toggle the touchpad on or off
  • You can use the xinput utility with the query-state switch and device ID to check if your programming is correct, for example:

    $ xinput query-state 12
    2 classes :
    ButtonClass
    button[1]=up
    button[2]=up
    button[3]=up
    button[4]=up
    button[5]=up
    button[6]=up
    button[7]=up
    ValuatorClass Mode=Relative Proximity=In
    valuator[0]=854
    valuator[1]=867
    
  • You are interested in the valuator values, which are X and Y coordinates of the TrackPoint
  • See the xinput source for more tips
  • To modify and rebuild this package:

    1. Get the source with apt-get source...
    2. Make your modifications to tools/syndaemon.c
    3. Disable the existing syndaemon patches by commenting out the 118... and 124... lines in debian/patches/series
    4. Build your modified package with dpkg-buildpackage -us -uc and the deb files will be in the parent directory.
7
  • 1
    Since the bounty will expire in three days, I'd have a deal with you (unless a better answer appears): I'll assign the bounty to you if you will point me to the API for querying a device by the xinput identifier and give a link to a page describing how to create a deb package from modified sources. Then I would be able to apply this approach. Would that be OK?
    – January
    Sep 4, 2012 at 14:03
  • Sorry, I have been away. That sounds fine, I'll try to find the information and edit the answer in a few hours.
    – ish
    Sep 7, 2012 at 9:31
  • no worries! that's fine
    – January
    Sep 7, 2012 at 9:34
  • 1
    As promised, you sir get the bounty. I do not accept the answer, however, because I need to code the solution first.
    – January
    Sep 8, 2012 at 9:18
  • 1
    @January, not sure if you did manage to code your solution yet? I've patched syndaemon to support monitoring the trackpoint. github.com/eyko/xf86-input-synaptics (commit here github.com/eyko/xf86-input-synaptics/commit/…) In order to monitor the TrackPoint, you need to pass the -T option flag when running syndaemon.
    – Vince
    Jul 7, 2013 at 3:20
5

First thing to be done is to know your touch pad id.So to do that follow these steps

First open terminal and Run this command

~$ xinput --list

Here we get this Touchpad id = <id Number>

After that open keyboard shortcuts then add this below two command with your keyboard shortcuts.

# Disable Touchpad:
xinput set-prop <id number> 'Device Enabled' 0

# Enable Touchpad:
xinput set-prop <id number> 'Device Enabled' 1

enter image description here enter image description here

1
  • Thanks, but disabling Touchpad manually is not the issue here (even with a shortcut), and I know how to do it. The idea is to disable Touchpad automatically while Trackpoint is being used, in a similar way the Touchpad is disabled automatically when keyboard is used (see the setting "disable touchpad while typing" in "Mouse and Touchpad" settings).
    – January
    Aug 31, 2012 at 10:09
0

Here is a low-tech solution that might be bad for power usage (the syndaemon -T patch didn't work for me).

#!/bin/sh

TRACKPOINT_DEV="TPPS/2 IBM TrackPoint"
SLEEP_TIME=5

OLD_XY=0,0,
while true; do
  NEW_XY=`xinput query-state "$TRACKPOINT_DEV" |grep valu|awk 'BEGIN { FS = "=" } ; {print $2 ","}'|xargs`
    if [ ! "$OLD_XY" = "$NEW_XY" ]; then
      synclient TouchpadOff=1
    else
      synclient TouchpadOff=0
    fi
    sleep $SLEEP_TIME
    OLD_XY="$NEW_XY"
done

It has to get a little bit lucky to notice that you are using the trackpoint, because it can only tell the coordinates during each 5s interval. In other words, it is conservative about disabling the touchpad but not should reliably re-enable it when the trackpoint is idle.

Anyway, it helps me a lot on my ultrabook with wandering cursor from palm press.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .