How to disable touchpad while using trackpoint on a Thinkpad?

Solution 1:

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.

Solution 2:

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 hereenter image description here