Skip to content

Conversation

@marmitar
Copy link
Contributor

@marmitar marmitar commented Sep 7, 2025

This PR pulls the updated SwipeTracker from GNOME 49.

Details

I reapplied the changes from swipeTracker.js 46.0 to v77 on top of 48.4. Then applied changes from 48 to swipeTracker.js 49.rc on top of that.

The notable changes form GNOME 46 to 49 are:

Additionally, I removed the unused allowedModes, to ensure it's never used anywhere, and reworked when the inverted parameter is applied, so we get a smaller number of changes from the Shell implementation. Also fixed a small typo of this._mouseScroll.canHandleEvent(...) in SwipeTracker.canHandleScrollEvent().

Screenshots

Here's it running on GNOME 49:

Screencast.From.2025-09-07.19-37-40.mp4

output.mp4

I don't have a working trackpad to test the actual gestures, so these tests are only for MouseScroll, but most of gesture code comes from GNOME Shell, so I don't think it would cause issues here.

@p91paul
Copy link
Collaborator

p91paul commented Sep 8, 2025

my 2 cents as former maintainer: supporting multiple gnome versions when code changes are necessary it's difficult and does not scale, especially when something akin to if (version = 48) is required. I suggest just dropping compatibility with gnome 48, and rely on the fact that extensions.gnome.org automatically gives people the last version compatibile with their gnome version.
Great work anyway!

@marmitar
Copy link
Contributor Author

marmitar commented Sep 8, 2025

Yeah, I agree @p91paul. I just implemented it like this because doing GNOME 46 to 48, then updating to 49 was easier then doing all at once, but it should be very simple to put one on top of the other instead. Edit: Another reason is that GNOME 49 is not released yet.

@dsheeler What do you think? Drop GNOME 48 or not? In that case, you may also want to wait a few days before merging this.

@dsheeler
Copy link
Owner

dsheeler commented Sep 8, 2025

@p91paul beat me to his comment. I don't think we should support older versions. Can you modify the pr?

This is great work. Thank you! Yesterday, I was in process of doing essentially what you did, and I was doing it by hand, and I introduced a bug that threw me off for a while then you fixed everything. Wonderful!

@marmitar
Copy link
Contributor Author

marmitar commented Sep 8, 2025

Yeah, as I commented on the issue, it didn't work out the first time for me. Then doing this 46 => 48 => 49 transition, I reduced the line diff from -66/+212 to -21/+176 to -18/+174. It's not brutal, but it did help.

@marmitar
Copy link
Contributor Author

marmitar commented Sep 8, 2025

Also, what was the issue you were having? Did you change the pushModal() line? I tried to set a different actionMode, even Shell.ActionMode.NORMAL, but it caused all kinds of bugs. I think it might be related to multiple Switchers being instantiated at the same time, but I'm not sure.

Pull swipeTracker.js from [GNOME 48][1] and reapply changes from
[GNOME 46][2] to [v77][3]. Also, completely removed the unused
`allowedModes` parameter and reworked when the `inverted` parameter is
applied.

[1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/48.4/js/ui/swipeTracker.js
[2]: https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/46.0/js/ui/swipeTracker.js
[3]: https://github.com/dsheeler/CoverflowAltTab/blob/v77/src/swipeTracker.js

Notable changes:
- Allow gestures with >3 fingers (gnome-shell!3275)
- Check all modifiers for modifier-scroll (gnome-shell!3725)
- Typo in this._mouseScroll.canHandleEvent(...)

Part of dsheeler#283
Add new SwipeTracker implementation based on [GNOME 49.rc][1]
and reapply changes on the new version.

[1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/49.rc/js/ui/swipeTracker.js

Closes dsheeler#283
@dsheeler
Copy link
Owner

dsheeler commented Sep 8, 2025

Mine wasn't related to yours. I removed a '!' from a conditional, d'oh. Just a typo.

I'm curious about what exactly you were trying to do with actionmode. I have a use case for using actionModes, actually. The switcher can be invoked by DBus. I've managed to invoke the switcher when in the overview mode, for example, when it should not be accessible.

@marmitar
Copy link
Contributor Author

marmitar commented Sep 8, 2025

I was trying to change the actionMode so that it wouldn't be necessary to comment every this._allowedModes & Main.actionMode. In fact, by having an actionMode different then Shell.ActionMode.NONE, it wouldn't even be necessary to copy all the Gesture classes from GNOME Shell. We could just subclass the SwipeTracker from resource:///org/gnome/shell/ui/swipeTracker.js and modify what we needed.

But the effects were very wild. The AppSwitcher seemed like it crashed, but didn't let some keyboard interactions reach other apps. I even had to kill the Shell at some point.

@dsheeler
Copy link
Owner

dsheeler commented Sep 9, 2025

Hmmm. I might give it a go myself and see how it goes...

I like the idea a lot of subclassing the SwipeTracker. Better than tracking diffs. I definitely kinda quickly jumped on just copying the class without thinking about anything else.

@marmitar
Copy link
Contributor Author

marmitar commented Sep 9, 2025

Oh, I found it in the reflog: commit eb9cea8. I think it's possible to reduce even more of the copy paste, but that was just a work in progress. And then I abandoned it when I realized that pushModal(..., { actionMode: Shell.ActionMode.NORMAL }) was the issue. Edit: but now I'm not so sure anymore.

@marmitar marmitar mentioned this pull request Sep 9, 2025
@dsheeler dsheeler changed the base branch from main to gnome-49 September 11, 2025 15:41
@dsheeler dsheeler merged commit 31db4bd into dsheeler:gnome-49 Sep 11, 2025
1 check passed
@dsheeler
Copy link
Owner

Hey @marmitar, I merged this into a gnome-49 branch. I'll merge into main when 49 comes out.

@marmitar marmitar deleted the feat/gnome-49 branch September 11, 2025 16:51
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.

TypeError: GestureAction is not an object or null (GNOME 49.rc)

3 participants