-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
Swipe Gestures #3926
Swipe Gestures #3926
Conversation
Hi, Thank you for sharing this great PR! I've reviewed the code and it was easy to follow. I'll test it as soon as I'm done with a big rework I'm working on. Some topics to discuss meanwhile:
Thank you 🙇 |
ace728e
to
55166ae
Compare
Thanks for the review and feedback @lwouis!
|
Hey @SaswatB, Thank you for your message I could finally deep dive on this PR today. I made some changes to it. Here's the current code with my changes. As I suspected, navigating the thumbnails with the swipe motion is not the best experience. It's surprisingly better than I expected, but it's still a bit clunky. For instance, there is no diagonal navigation. I think we should rework it to create some kind of virtual cursor, as I believe Windows 11 does. I'm not sure how to move forward:
I'm leaning towards the last option. Another thing we need to figure out is to avoid the gesture passing-through to the active app when AltTab is open. I've started trying to implement that in the branch I linked. Do you think you could implement the virtual cursor navigation? I think it shouldn't be too hard. We want the gestures to move this invisible cursor around. They we can check if it's above a thumbnail, in which case we select it. This is actually probably easier than the current implementation. What do you think? Thank you 🙇 |
I'd dug a bit if we could detect if there are swipe conflicts. There are 2 settings in System Settings which can bind swipes an action: We can read the state of swipe-binding from the OS: These preferences can have each the following values:
It's interesting to note that if the user select Overriding the values doesn't seem to work. For instance, running I'm thinking that it would be nice to detect conflicts on launch, and ask the user with a dialog:
Update: there is also one Accessibility feature which uses 3-finger mouvement: We can also detect its usage using defaults. The key is Thus we could detect a conflict if any of the 3 keys has a non-0 value. |
Update: more problems. macOS seems to have hidden gestures. They are not documented, but users can, by default:
I don't think we can detect these. I don't think users can turn them off as well. This makes it so that if AltTab is running, the user may lose those features. More precisely, AltTab may appear and react, and at the same time the user is using the native features in the background (selecting or scrolling). The code in the branch I shared does exactly that. In general, when we call However for gesture taps, it seems that we can't absorb gesture events. Even when we I did a lot of research on various git repos to try and find a way to intercept these events, so the active app doesn't receive them. I thought I found this app which does it. It turns out that it triggers the native command+tab, and that switcher will block multitouch events while it's open. That's very convenient. I wish we could do that, but it likely uses private APIs we can't access. |
One avenue we could explore is replacing the It seems that Karabineer is using it. Also this small app Origami could be a good case-study. I tried to use it to understand. However, for some reason, I don't seem to have the MultitouchSupport.framework on my mac. Maybe I deleted it by mistake? If anyone could share a zip here, it would really help. In the meanwhile, I can't compile any of these project since it can't link to the framework at build-time. My goal would be to see if using these APIs, we are able to capture the events, and avoid having them pass-through to the active app like is the case with |
Hey @lwouis! I don't really have a solution for preventing the gesture passthrough, there's hypothetically a way in the quartz tap to stop event propagation but I haven't gotten that to work. I think adding conflict detection like that could be nice for a follow-up pr when there's time, and in the mean time a compromise could be keeping this feature disabled by default. As it stands this has been a feature that's been attempted for a number of years, I'm hoping we can make it in with the momentum we have right now. |
Hi, Indeed, I think there is no benefit to the private APIs:
Going forwards, since there are so many issues with this feature, indeed we have to disable it by default. Power-users can then enable it and accept the limitations and actively mitigate them on their side. The last thing before we ship this is to fix the UI. Currently there are 2 issues:
Could you please look into fixing those? I've pushed the swipe branch which is up to date with Thank you 🙇 |
Regarding the swiping conflicts and thumbnails browsing, I've recorded this video. I thought it's complex to discuss with text only, and a video would be much clearer 👍 Could you please have a look? Note: in the video I mentioned that I email BTT's author. He's already replied to me. What a legend. Here's his reply:
Warping the mouse is interesting. I'm thinking that my solution of having a big invisible window may be even better for our use-case since it would absorb every event natively. It would not deal with the OS gestures if they are ON, but it would deal with everything else. And for those, we could ask the user to disable them. That would also allow us to not mention the Accessibility Trackpad Dragging since that case would be neutralized by the transparent window. |
Thank you for your message I'll try to implement the fullscreen invisible window trick. I'll release the feature soon, with or without the trick 👍 I've also decided to remove Shortcut 4 and 5. Looking at the Debug Profiles in the github issues here, there are barely used. It will clean things up to have only 3 + the gesture. Thank you |
I was able to find a solution for the issue. I generate a synthetic mousewhell event when we get a 3/4-finger swipe event. This way, any ongoing scroll is stopped. Using an invisible didn't work because once a scrolling event is started, it will continue, even if the window is no longer under the mouse, or in focus. we have to break that scrolling event. The native command+tab launcher doesn't have this issue because it's not started by a swipe. However, you can start a scroll on the trackpad, and keep it going as you command+tab. You will see that they don't stop it. It's not a problem for them since it's trackpad (scroll) + keyboard (command+tab). But in our case, we are trackpad (scroll) + trackpad (alttab), so we need to deal with it. The synthetic event does the trick nicely. I don't think it will cause any undesired side-effect either. Hopefully I'm not missing a scenario here. I thought to still add the invisible window for another reason. That is: to stop mouse and trackpad events from reaching behind the switcher. I noticed that the native command+tab doesn't let anything through. After thinking about it more, I think it's actually nice to be able to scroll behind to see something without stopping AltTab. I may revisit this, but for now I'm fine with it. Swipping works well with the new synthetic event! Thank you 🙇 |
The feature shipped in the latest release 🥳 The only thing I've now like to see improved with the trackpad, is the navigation. Using the virtual cursor I mentioned. That would be really nice 👍 |
Awesome to hear, thanks for everything! |
Based on #2355
Resolves #730
Thanks to @ris58h for the proof of concept!
This PR builds on top of the original PR:
The only outstanding issue is #2355 (comment)
AltTab uses background threads to process system events but I couldn't make a separate thread that accepts touch events.
, but I wasn't able to find any actual issues when using this.