Skip to content
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

macOS: Allow mouse buttons 4 and 5 to navigate history #8641

Closed
vadimcn opened this issue Jul 1, 2016 · 100 comments
Closed

macOS: Allow mouse buttons 4 and 5 to navigate history #8641

vadimcn opened this issue Jul 1, 2016 · 100 comments
Assignees
Labels
feature-request Request for new features or functionality macos Issues with VS Code on MAC/OS X upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream verification-needed Verification of issue is requested verified Verification succeeded workbench-history History item issues
Milestone

Comments

@vadimcn
Copy link
Contributor

vadimcn commented Jul 1, 2016

  • VSCode Version: 1.2.1
  • OS Version: All

Some mice have "forward" and "back" buttons in addition to the standard ones. Would be nice to to be able to bind those to VSCode's navigateForward/navigateBack actions.

@rozzzly
Copy link

rozzzly commented Jul 2, 2016

From my experience, this is highly dependant on one's mouse setup. Most mice I have seen have the default setup has those mouse buttons mapped to the keys: alt+left, alt+right for back, and forward respectively.

Edit: I just realized that Windows actually emits a dedicated virtual key code for those buttons, Usually named something to the effect of VK_BROSWER_BACK this is what vscode listens for, not alt+left... by default that is...

I have a Logitech G7000s which has 8 buttons addition button. Logitech ships it with software that lets you map what happens when you press a key. I would check your mouse's manufacture to see what they have available. If there's nothing of use/usable on your OS, there's a bunch of software out there to help you do it manually.

Having switched to Linux a month or so back, I had the fun experience of using xbindkeys to listen for the mouse button to be pressed, and then using xte to emit the corresponding series of virtual keystrokes.

@bpasero
Copy link
Member

bpasero commented Jul 2, 2016

Note that currently we only support these buttons on Windows. There they are bound to navigating in the history.

@bpasero bpasero added feature-request Request for new features or functionality upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Jul 2, 2016
@bpasero bpasero added this to the Backlog milestone Jul 2, 2016
@bpasero bpasero self-assigned this Jul 2, 2016
@bpasero bpasero removed their assignment Aug 17, 2016
@jcogilvie
Copy link

+1 for linux support. I'd love to have the default behavior match that of other applications, or at least be customizable (e.g. browsers, eclipse).

@g5codyswartz
Copy link

it's driving me crazy when I follow a definition and then want to jump back to where I was. Right now it just changes the indent on the current line. (I've been loving and abusing this in slack lately :P)

@karolmie1
Copy link

@g5codyswartz for temporary fix you can use ctrl-o ctrl-i vim bindings with vim plugin. But having this on mouse too would be pretty sweet. (gd for jumping to definition)

@Naereen
Copy link

Naereen commented Jul 19, 2017

Still not implement in Electron (see electron/electron#6996) but this node module was made especially to tackle this issue.
Could it be used for VS-Code to solve this?

@doppio
Copy link

doppio commented Jul 26, 2017

+1 for macOS too. Is there any reason this has to be platform-specific?

@luispabon
Copy link

Be great to get this in Linux. I've managed to translate across all of my IntelliJ shortcuts except for this one (Microsoft ergonomic sculpt mouse).

@dbeckwith
Copy link

Is there at least a general way of mapping mouse buttons to actions? Like if the button was just received as "button 4" or something?

@Naereen
Copy link

Naereen commented Oct 17, 2017

For all: please look at the beginning of the thread! This issue cannot be solved (apparently) from the VSCode side, it is (currently) a limitation from electron!

@bpasero bpasero added keybindings VS Code keybinding issues and removed workbench labels Nov 16, 2017
@skyjur
Copy link

skyjur commented May 9, 2018

If anyone looking for Linux solution: xbindkeys and xdotool can be used to trigger keyboard sequence on mouse clicks. This is what I'm using:

~/.xbindkeysrc

"xdotool key alt+Left"
	b:9
"xdotool key alt+Right"
	b:8	

@Naereen
Copy link

Naereen commented May 9, 2018

@skyjur That's a cute solution, but won't be satisfactory for most people I guess; nobody wants a special keyboard shortcut to be system-wise if it should only be used from within a single software!
(but maybe I'm just a little bit too picky…)

@samuelchanx
Copy link

If you are using BetterTouchTool on Mac you can map the mouse shortcuts to keyboard shortcuts specific to VSCode application, like button4 to Cmd [ for navigating back in VSCode.

It works like a charm for me :)

image

@luispabon
Copy link

It can't be hard to make these bindable in Linux, and especifically in Electron apps, since my back button works fine in Chrome/Chromium to begin with (and elsewhere, including PhpStorm).

@luispabon
Copy link

@skyjur unfortunately that won't help Wayland users I'm afraid. This should totally be doable in the app without any hacks.

@rozzzly
Copy link

rozzzly commented May 17, 2018

@luispabon

It can't be hard to [...] in Linux

😂

@luispabon
Copy link

;)

@aravindbattaje
Copy link

@skyjur thanks for the suggestion. Although I'm not completely comfortable doing this, I cannot dispense with mouse-based navigation. I'd to switch the order for Logitech MX Master 2 on Ubuntu 16.04 though.

That is,

"xdotool key alt+Left"
	b:8
"xdotool key alt+Right"
	b:9

@luispabon
Copy link

Seriously, this doesn't need any X hacks to work properly. Chrome and chromium work fine with mouse navigation buttons and have done so for years. Something's not wired up properly on the vscode codebase itself.

@noppa
Copy link

noppa commented May 23, 2018

That it works in Chrome doesn't automatically mean that it'd work in Electron apps.

For what it's worth, the mouse buttons work in Slack and Spotify Windows clients (which are Electron apps AFAIK) but not in Linux clients.

The related Electron issue was already linked here electron/electron#6996

@aapocketz
Copy link

aapocketz commented Jul 30, 2018

I adopted your hacky linux workaround using xbindkeys, but I didn't want it messing with the normal mouse buttons so I did this:

"xdotool key --clearmodifiers alt+Left"
	control + b:9
"xdotool key --clearmodifiers alt+Right"
	control + b:8

I have to hit control to navigate using the buttons, but my finger is usually there since I control click to follow functions anyway. Such a silly minor thing to support the navigation buttons, but was driving me nuts.

@bpasero bpasero added the bug Issue identified by VS Code Team member as probable bug label Oct 16, 2019
@bpasero bpasero changed the title macOS: allow to use mouse "forward" and "back" buttons for navigation macOS: mouse buttons 4 and 5 cannot be used to navigate history Oct 16, 2019
@trungklam
Copy link

Easy: https://bugs.chromium.org/p/chromium/issues/detail?id=1014938

Now if it is not too much work for people to click the upvote on that issue at least...

Thank you :) Just have a look on it and upvote. Hope we can get the response soon :)

@bpasero bpasero changed the title macOS: mouse buttons 4 and 5 cannot be used to navigate history macOS: Allow mouse buttons 4 and 5 to navigate history Oct 28, 2019
@bpasero bpasero added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Oct 28, 2019
@bpasero bpasero removed their assignment Oct 28, 2019
@bpasero bpasero added this to the Backlog milestone Oct 28, 2019
@bpasero bpasero self-assigned this Jan 23, 2020
@bpasero bpasero modified the milestones: Backlog, January 2020 Jan 23, 2020
@bpasero
Copy link
Member

bpasero commented Jan 23, 2020

It looks like https://chromium-review.googlesource.com/c/chromium/src/+/1742855 fixed this for Chrome 78 and if we ship with Electron 7 this month, I can enable it. Just confirmed that it works.

@bpasero
Copy link
Member

bpasero commented Feb 7, 2020

VSCode insiders has resumed with Electron 7. To benefit from this change you can give our preview releases a try from: https://code.visualstudio.com/insiders/

@bpasero bpasero closed this as completed Feb 7, 2020
@bpasero bpasero added the verification-needed Verification of issue is requested label Feb 7, 2020
@nx-giap
Copy link

nx-giap commented Feb 10, 2020

If you are using BetterTouchTool on Mac you can map the mouse shortcuts to keyboard shortcuts specific to VSCode application, like button4 to Cmd [ for navigating back in VSCode.

It works like a charm for me :)

image

Work with me.
Mac 10.14.6
VSCode 1.42.0

@TheFlowerpotMan
Copy link

It's glorious! Thank you!
1.43.0-insider
OS 10.15.2

@vdechenaux
Copy link

👍 It works !

But, I have SensibleSideButtons to have theses buttons working on other programs like Firefox, and I have to disable it.

Now it's working in vscode and no more in Firefox.. 😅

@bpasero bpasero added the verified Verification succeeded label Feb 21, 2020
@JimAmuro
Copy link

I have upgraded to 1.43 stable version on mac, but my 4/5 buttons still doesn't seem to work... Do I need to turn on some settings? Thanks!

@trungklam
Copy link

trungklam commented Mar 10, 2020

I have upgraded to 1.43 stable version on mac, but my 4/5 buttons still doesn't seem to work... Do I need to turn on some settings? Thanks!

If you have SensibleSideButtons running on your mac, try to turn it off. I tested and this feature only works with SensibleSideButtons disabled, so I have to choose between firefox + system navigation or VSCode navigation.
Seems that because of the SensibleSideButtons bind the Mouse 4 and 5 to the swipe left/right gestures so It doesn't work. I'm not sure if we are able to make swipe left/right gestures of Mac to be navigate-able in VSCode.

@JimAmuro
Copy link

I have upgraded to 1.43 stable version on mac, but my 4/5 buttons still doesn't seem to work... Do I need to turn on some settings? Thanks!

If you have SensibleSideButtons running on your mac, try to turn it off. I tested and this feature only works with SensibleSideButtons disabled, so I have to choose between firefox + system navigation or VSCode navigation.
Seems that because of the SensibleSideButtons bind the Mouse 4 and 5 to the swipe left/right gestures so It doesn't work. I'm not sure if we are able to make swipe left/right gestures of Mac to be navigate-able in VSCode.

Thanks for telling me this. I don't have that software running, but indeed I am using Logitech Options driver, which might rebind my 4/5 keys to some other keys called "forward/back". Although it works on chrome, it doesn't work in vscode. After killing the driver deamon, the 4/5 keys work in vscode, but other custom keys dead... So I have to live with Logi driver. Don't know why it functions well on Windows, hope this could be fixed on mac soon!

@jpmcb
Copy link

jpmcb commented Mar 10, 2020

@JimAmuro same - I am using a Logi ergo mouse with Logi Options and the daemon running and I do not get back and forward working ...

@bpasero Is there a setting in VSCode that would detect this context and enable this to work with logi options?

@bpasero
Copy link
Member

bpasero commented Mar 10, 2020

No there is no setting and I doubt Electron would provide the APIs for us to detect this. If you feel strong about it, ask for it over at https://github.com/atom/electron

I suggest we stop discussion here and move to new issues as needed to reduce the spam for people subscribed to this otherwise closed issue.

@douglascayers
Copy link

On macOS using a Logitech mouse with the Logi Options driver, I only needed to rebind the keystrokes that the Mouse buttons 4/5 (sidebar buttons) perform and which keystrokes the VS Code workbench.action.navigateBack and workbench.action.navigateForward actions are bound to.

  • I bound the mouse "backward" button and the VS Code navigate backward action to Cmd+LeftArrow.
  • I bound the mouse "forward" button and the VS Code navigate forward action to Cmd+RightArrow.

I chose those keybindings because they continued to navigate forward/backward in Chrome for me, too. Felt like a win-win-win scenario.

Screenshot of VS Code keyboard shortcuts on top with the Logi Options window on bottom
image

macOS Catalina: 10.15.3
Logitech Mouse: M510
Logi Options: 8.10.64 (driver for the mouse)
VS Code Version: 1.43.0
Commit: 78a4c91
Date: 2020-03-09T19:34:44.548Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.3.0

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality macos Issues with VS Code on MAC/OS X upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream verification-needed Verification of issue is requested verified Verification succeeded workbench-history History item issues
Projects
None yet
Development

No branches or pull requests