-
-
Notifications
You must be signed in to change notification settings - Fork 629
feat: Add touch gesture support (mostly hardcoded) #3180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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-scrollconfiguration 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.
| // Overview always uses uninverted delta, matching touchpad behavior. | ||
| if let Some(redraw) = self | ||
| .niri | ||
| .layout | ||
| .overview_gesture_update(-delta_y, timestamp) |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
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.
| // 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) |
| }; | ||
| let slot = evt.slot(); | ||
|
|
||
| // Track touch gesture with 2+ fingers. |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
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.
| // Track touch gesture with 2+ fingers. | |
| // Track touch gesture movement once 2+ fingers are down; processing requires 3+ fingers. |
|
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 |
I appreciate you taking the time do so. Thank youc
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? |
|
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 |
1e205bd to
dd2f4ba
Compare
- 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
dd2f4ba to
36314ba
Compare
SinceannotationTesting:
transition is held in place by the two fingers and finishes if a 2nd is
removed and correctly snaps into place.
animations enabled)