Skip to content

Conversation

seivan
Copy link
Contributor

@seivan seivan commented Aug 20, 2025

Closes #4954

Replaces #14939

Release Notes:

Added:

  • Swipe to Navigate for macOS
  • Listeners for both horizontal and vertical swipes
  • Only active for horizontal for now

Requires these macOS settings:
image

Older macOS settings:
image

Note:
I altered the logic from #23332 or more specifically, I hard-coded the values to match native macOS swiping. I don't have that exact mouse and software to try to see if it works with the new values.
Either way, mouse navigation with btn4/5 still works out of the box on macOS for most mouses.
Whatever custom software that mouse uses, it disguises itself as a swipe event, so hopefully it also matches the delta values of one.

Thinking of using config to register custom actions to send for either axis, while defaulting for tab navigation for horizontal, and disabled for vertical, but that would be a separate PR.

Something like

"workbench.editor.swipeToNavigate": {
  "horizontal": "disabled",
  "vertical": { "previous": "customAction", "next": "someOtherCustomAction" }
}

Release Notes:

  • Added three finger swipe to navigate.

@Copilot Copilot AI review requested due to automatic review settings August 20, 2025 10:30
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Aug 20, 2025
Copilot

This comment was marked as outdated.

@seivan seivan force-pushed the feature/swipeToNavigate branch from 01ff86d to c0e1781 Compare August 20, 2025 10:40
@maxdeviant maxdeviant changed the title feat: Adding Swipe to Navigate for macOS gpui: Add "swipe to navigate" for macOS Aug 20, 2025
@seivan seivan requested a review from Copilot August 26, 2025 14:59
Copy link
Contributor

@Copilot 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

Implements swipe gesture navigation for macOS, allowing users to navigate tabs using horizontal swipe gestures on trackpads. This feature maps left swipe to "pane::GoBack" and right swipe to "pane::GoForward" actions.

  • Adds touchpad gesture support infrastructure with TouchPadGestureEvent and SwipeDirection types
  • Converts macOS swipe events from mouse navigation simulation to proper touchpad gesture events
  • Implements swipe-to-action mapping in the window event dispatcher

Reviewed Changes

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

File Description
crates/gpui/src/interactive.rs Adds touchpad gesture event types and platform input handling
crates/gpui/src/platform/mac/events.rs Converts macOS swipe events to touchpad gestures instead of mouse navigation
crates/gpui/src/window.rs Implements swipe gesture event dispatching and action mapping

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@seivan seivan force-pushed the feature/swipeToNavigate branch 2 times, most recently from d51edbd to baf8960 Compare August 26, 2025 15:07
@seivan seivan force-pushed the feature/swipeToNavigate branch 2 times, most recently from 7eafc45 to 9f2482e Compare September 1, 2025 11:40
@seivan
Copy link
Contributor Author

seivan commented Sep 1, 2025

Warnings
⚠️
This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 7eafc45

Done

@seivan seivan force-pushed the feature/swipeToNavigate branch from 9f2482e to 07da552 Compare September 1, 2025 12:54
@seivan
Copy link
Contributor Author

seivan commented Sep 1, 2025

Fixed formatting issues with imports.

@seivan seivan force-pushed the feature/swipeToNavigate branch 5 times, most recently from dd8a5ac to bbc2238 Compare September 1, 2025 18:28
@seivan seivan force-pushed the feature/swipeToNavigate branch from bbc2238 to 654ff14 Compare October 3, 2025 10:17
@seivan
Copy link
Contributor Author

seivan commented Oct 3, 2025

@ConradIrwin Any chance you can take a look at this now? It's been more than six weeks now.

@seivan seivan force-pushed the feature/swipeToNavigate branch 2 times, most recently from 0c62a4e to 34fd549 Compare October 9, 2025 22:11
Copy link
Member

@mikayla-maki mikayla-maki left a comment

Choose a reason for hiding this comment

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

Hello!

Please add or modify a GPUI example to demonstrate this touch behavior, so that we can test this :)

Release Notes:

  - Introduced swipe gestures for navigation on macOS.
@seivan seivan force-pushed the feature/swipeToNavigate branch from 34fd549 to 472beac Compare October 17, 2025 05:50
@seivan
Copy link
Contributor Author

seivan commented Oct 17, 2025

Hello!

Please add or modify a GPUI example to demonstrate this touch behavior, so that we can test this :)

Hello!

Please add or modify a GPUI example to demonstrate this touch behavior, so that we can test this :)

I'm a bit confused here, are you saying you're currently unable to test it as is?
Or that you really want a separate demo example in crates/gpui/examples?

@mikayla-maki
Copy link
Member

mikayla-maki commented Oct 17, 2025

Or that you really want a separate demo example in crates/gpui/examples?

✅ separate examples make it easy to test how features look and feel, and are the primary way they're developed and documented in GPUI right now. See the window_positioning example, for example! :D

@seivan
Copy link
Contributor Author

seivan commented Oct 17, 2025

Or that you really want a separate demo example in crates/gpui/examples?

✅ separate examples make it easy to test how features look and feel, and are the primary way they're developed and documented in GPUI right now. See the window_positioning example, for example! :D

Yeah but this is a feature for Zed, not the gpui crate.

I would have to put a large portion of Zed, more specifically crates/workspace/src as an example as it requires Panes to be demoed. You guys added the gpui tag here, not me. If you are ok with that, then sure.

@seivan
Copy link
Contributor Author

seivan commented Oct 17, 2025

Actually, I think I got it. One sec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for macOS 'Swipe between pages' gesture

2 participants