libinput: Palm detection

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Palm detection

Palm detection tries to identify accidental touches while typing.

On most laptops typing on the keyboard generates accidental touches on the touchpad with the palm (usually the area below the thumb). This can lead to cursor jumps or accidental clicks.

Interference from a palm depends on the size of the touchpad and the position of the user's hand. Data from touchpads showed that almost all palm events on a Lenovo T440 happened in the left-most and right-most 5% of the touchpad. The T440 series has one of the largest touchpads, other touchpads are less affected by palm touches.

# Palm exclusion zones

libinput enables palm detection on the edge of the touchpad. Two exclusion zones are defined on the left and right edge of the touchpad. If a touch starts in the exclusion zone, it is considered a palm and the touch point is ignored. However, for fast cursor movements across the screen, it is common for a finger to start inside an exclusion zone and move rapidly across the touchpad. libinput detects such movements and avoids palm detection on such touch sequences.

Each exclusion zone is divided into a top part and a bottom part. A touch starting in the top part of the exclusion zone does not trigger a tap (see Tap-to-click behaviour).

In the diagram below, the exclusion zones are painted red. Touch 'A' starts inside the exclusion zone and moves almost vertically. It is considered a palm and ignored for cursor movement, despite moving out of the exclusion zone.

Touch 'B' starts inside the exclusion zone but moves horizontally out of the zone. It is considered a valid touch and controls the cursor.

Touch 'C' occurs in the top part of the exclusion zone. Despite being a tapping motion, it does not generate an emulated button event. Touch 'D' likewise occurs within the exclusion zone but in the bottom half. libinput will generate a button event for this touch.

# Palm detection during trackpoint use

If a device provides a trackpoint, it is usually located above the touchpad. This increases the likelihood of accidental touches whenever the trackpoint is used.

libinput disables the touchpad whenever it detects trackpoint activity for a certain timeout until after trackpoint activity stops. Touches generated during this timeout will not move the pointer, and touches started during this timeout will likewise not move the pointer (allowing for a user to rest the palm on the touchpad while using the trackstick). If the touchpad is disabled, the top software buttons remain enabled.

# Disable-while-typing

libinput automatically disables the touchpad for a timeout after a key press, a feature traditionally referred to as "disable while typing" and previously available through the syndaemon(1) command. libinput does not require an external command and the feature is currently enabled for all touchpads but will be reduced in the future to only apply to touchpads where finger width or pressure data is unreliable.

Notable behaviors of libinput's disable-while-typing feature:

- Two different timeouts are used, after a single key press the timeout is short to ensure responsiveness. After multiple key events, the timeout is longer to avoid accidental pointer manipulation while typing.
- Some keys do not trigger the timeout, specifically some modifier keys (Ctrl, Alt, Shift, and Fn). Actions such as Ctrl + click thus stay responsive.
- Touches started while typing do not control the cursor even after typing has stopped, it is thus possible to rest the palm on the touchpad while typing.
- Physical buttons work even while the touchpad is disabled. This includes software-emulated buttons.

Disable-while-typing can be enabled and disabled by calling libinput_device_config_dwt_set_enabled().

# Thumb detection

Many users rest their thumb on the touchpad while using the index finger to move the finger around. For clicks, often the thumb is used rather than the finger. The thumb should otherwise be ignored as a touch, i.e. it should not count towards Clickfinger behavior and it should not cause a single-finger movement to trigger Two-finger scrolling.

libinput uses two triggers for thumb detection: pressure and location. A touch exceeding a pressure threshold is considered a thumb if it is within the thumb detection zone.

Note
  "Pressure" on touchpads is synonymous with "contact area", a large touch surface area has a higher pressure and thus hints at a thumb or palm touching the surface.

Pressure readings are unreliable at the far bottom of the touchpad as a thumb hanging mostly off the touchpad will have a small surface area. libinput has a definitive thumb zone where any touch is considered a resting thumb.

The picture above shows the two detection areas. In the larger (light red) area, a touch is labelled as thumb when it exceeds a device-specific pressure threshold. In the lower (dark red) area, a touch is labelled as thumb if it remains in that area for a time without moving outside.