microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.71k stars 29.46k forks source link

macOS: Allow mouse buttons 4 and 5 to navigate history when using SensibleSideButtons (or when not using a mouse) #112087

Closed Akrabut closed 3 years ago

Akrabut commented 3 years ago

This has been discussed in length here, but other than some partial workarounds, there doesn't seem to be a fix but it has been automatically closed.

SensibleMouseButtons binds the mouse 4 and 5 buttons to swipe left/right gestures.

I'm creating a new issue to focus the context - what we need is VSCode to allow these gestures to be used as back/forward bindings.

If this cant be implemented any time soon I'd be happy to be directed to the relevant code to contribute a fix.

Note that as far as I know, this issue is not just with mice + SensibleSideButtons but also when using the touch pad (or however Apple calls it) as mouse.

bpasero commented 3 years ago

I am only considering a change in VSCode if this can be done through web standards. I will not accept a native/electron only solution because I am not willing to maintain more Electron specific APIs that have a chance to break due to little selfhosting. Thanks for understanding that.

Would it make sense to start a thread on a Chromium user group to ask what would be needed? Also https://github.com/MicrosoftEdge/MSEdgeExplainers might be a place to start a discussion around this topic?

Akrabut commented 3 years ago

I'm a little foreign to the what happens under the hood here, but given the fact that the swipe left/right gestures work normally in Chromium browsers and this is what SensibleSideButtons bind the buttons to, why wouldn't this be possible through web standards?

bpasero commented 3 years ago

We have this code to support back/forward navigation when mouse buttons 4 or 5 are pressed:

https://github.com/microsoft/vscode/blob/2feb009c8efce2ab0b6ac03d4e143854bf413d57/src/vs/workbench/services/history/browser/history.ts#L164-L177

If something does not work as you expect here, I feel this would be a bug to be reported against e.g. Chrome to get into web standards.

But maybe I misunderstood the request here?

Akrabut commented 3 years ago

As mentioned in this comment, Apple likes to be special and has it's back/forward bound to "swipe left" and "swipe right" when using their touch pad (their mice don't have mouse 4 and 5).

SensibleSideButtons bind those gestures to mouse 4 and 5 so you can use mouse 4 and 5 like you do in other operating systems.

While this works for navigation in browsers, it doesn't seem to work in vscode as (I suppose) said swipe gestures cant be bound to functionalities.

bpasero commented 3 years ago

Thanks for explaining this, again: if you can point me to some events I can listen to besides the one we have for buttons 4 and 5, I am happy to add it, but I feel this is something that needs to be fixed outside of the VSCode repository in some other component.