Skip to content

Conversation

@Atan-D-RP4
Copy link

  • Brings the touchscreen gestures to parity with touchpad/trackpad gestures, as best I can tell
  • Matches behavior of touchpad gestures closely
  • Updated docs with Since annotation
  • Added natural-scroll config option for touchscreen gestures

Testing:

  • 3-finger horizontal swipe correctly adjusts view offsets.
  • 3-finger vertical swipe correctly switches workspaces
  • 2-finger start into 3rd mid-gesture -> works
  • During 3-finger gesture, when one finger is removed mid-gesture, the
    transition is held in place by the two fingers and finishes if a 2nd is
    removed and correctly snaps into place.
  • Gestures during:
    • window animations -> works (tested with spawning windows with
      animations enabled)
    • window dragging -> works (though very slow when dragging windows in

Copilot AI review requested due to automatic review settings January 2, 2026 14:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive touchscreen gesture support to bring touch gestures to parity with touchpad/trackpad gestures. The implementation enables multi-finger touch gestures for workspace switching, view scrolling, and overview toggling, with a configurable natural-scroll option.

  • Implements multi-finger gesture detection (2, 3, and 4+ fingers) for touchscreens
  • Adds gesture recognition with 16px threshold matching touchpad behavior
  • Introduces natural-scroll configuration option for touchscreen gestures

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/niri.rs Adds state tracking fields for touch gesture points and cumulative deltas, imports TouchSlot type
src/input/mod.rs Implements touch event handlers (down, up, motion, cancel) with gesture detection, direction determination, and animation updates
niri-config/src/input.rs Adds natural_scroll boolean field to Touch configuration struct
docs/wiki/Configuration:-Input.md Documents the new natural-scroll configuration option with "Since: next" annotation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4335 to +4342
// Overview always uses uninverted delta, matching touchpad behavior.
if let Some(redraw) = self
.niri
.layout
.overview_gesture_update(-delta_y, timestamp)
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overview gesture is using the raw delta_y instead of gesture_delta_y, which means it bypasses the natural_scroll configuration. This is inconsistent with the comment on line 4335 which states "matching touchpad behavior." The touchpad code uses uninverted_delta_y for overview, which means it also ignores natural scroll. However, for touchscreen, using the raw delta may be confusing since the workspace switch and view offset gestures respect natural scroll. Consider whether this is the intended behavior or if it should use gesture_delta_y for consistency with other touchscreen gestures.

Suggested change
// Overview always uses uninverted delta, matching touchpad behavior.
if let Some(redraw) = self
.niri
.layout
.overview_gesture_update(-delta_y, timestamp)
// Overview always uses uninverted delta on touchpad; touchscreen follows natural scroll.
if let Some(redraw) = self
.niri
.layout
.overview_gesture_update(gesture_delta_y, timestamp)

Copilot uses AI. Check for mistakes.
};
let slot = evt.slot();

// Track touch gesture with 2+ fingers.
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "Track touch gesture with 2+ fingers" but the actual gesture processing only occurs when there are 3 or more fingers (line 4252 checks >= 3). This comment is misleading. Update the comment to accurately reflect that gesture processing requires 3+ fingers, while the tracking itself starts with 2 fingers for recognition purposes.

Suggested change
// Track touch gesture with 2+ fingers.
// Track touch gesture movement once 2+ fingers are down; processing requires 3+ fingers.

Copilot uses AI. Check for mistakes.
@Sempyos
Copy link
Contributor

Sempyos commented Jan 3, 2026

I'm just going to say my opinions on this,

I am not terribly a uh fan of having hardcoded gesture bindings, as this could Interfere with some apps that utilize 3 fingers, additionally this will break quite a few people's configurations with lisgd and similar programs. This should also probably, uh be customizable and would require time to design

@Atan-D-RP4
Copy link
Author

I'm just going to say my opinions on this,

I appreciate you taking the time do so. Thank youc

I am not terribly a uh fan of having hardcoded gesture bindings, as this could Interfere with some apps that utilize 3 fingers, additionally this will break quite a few people's configurations with lisgd and similar programs. This should also probably, uh be customizable and would require time to design

Yeah, fair criticism. I'd rather be they be more customizable too but for now I only matched current touch pad gestures.

This and basically a bunch of other changes to gestures stuff is waiting on the author to settle on the design for the gestures interface.

Thanks for letting me know about lisgd! Seems great and I'm gonna play with it, and test this there too see how things break.

Do you think the current hardcoded touchpad gestures also cause the same problems you described here?

@Sempyos
Copy link
Contributor

Sempyos commented Jan 3, 2026

I don't think I have run into any app that has needed me to use more than 2 fingers..? Usually the most I need is 2 for zooming and such

@Atan-D-RP4 Atan-D-RP4 force-pushed the feat/touch-gestures branch from 1e205bd to dd2f4ba Compare January 7, 2026 13:15
- Brings the touchscreen gestures to parity with touchpad/trackpad
  gestures, as best I can tell
- Matches behavior of touchpad gestures closely
- Updated docs with `Since` annotation
- Added natural-scroll config option for touchscreen gestures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants