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

Comments

@vadimcn
Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member

@bpasero 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 this to the Backlog milestone Jul 2, 2016
@bpasero bpasero self-assigned this Jul 2, 2016
@bpasero bpasero added the workbench label Jul 2, 2016
@bpasero bpasero removed their assignment Aug 17, 2016
@jcogilvie

This comment has been minimized.

Copy link

@jcogilvie jcogilvie commented Aug 25, 2016

+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

This comment has been minimized.

Copy link

@g5codyswartz g5codyswartz commented Mar 3, 2017

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

This comment has been minimized.

Copy link

@karolmie1 karolmie1 commented May 3, 2017

@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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

@doppio doppio commented Jul 26, 2017

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

@luispabon

This comment has been minimized.

Copy link

@luispabon luispabon commented Sep 14, 2017

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).

@ioan-ungurean

This comment has been minimized.

Copy link

@ioan-ungurean ioan-ungurean commented Oct 6, 2017

Any updates on this? It is really that hard to make Mouse4, Mouse5 etc. buttons bindable on Linux?

@dbeckwith

This comment has been minimized.

Copy link

@dbeckwith dbeckwith commented Oct 16, 2017

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

This comment has been minimized.

Copy link

@Naereen 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 and removed workbench labels Nov 16, 2017
@skyjur

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

@samuelchanx samuelchanx commented May 16, 2018

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

This comment has been minimized.

Copy link

@luispabon luispabon commented May 16, 2018

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

This comment has been minimized.

Copy link

@luispabon luispabon commented May 16, 2018

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

@rozzzly

This comment has been minimized.

Copy link

@rozzzly rozzzly commented May 17, 2018

@luispabon

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

😂

@luispabon

This comment has been minimized.

Copy link

@luispabon luispabon commented May 17, 2018

;)

@aravindbattaje

This comment has been minimized.

Copy link

@aravindbattaje aravindbattaje commented May 22, 2018

@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

This comment has been minimized.

Copy link

@luispabon luispabon commented May 23, 2018

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

This comment has been minimized.

Copy link

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

@bpasero bpasero added the 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
@Happin3ss

This comment has been minimized.

Copy link

@Happin3ss Happin3ss commented Oct 17, 2019

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 and removed 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

This comment has been minimized.

Copy link
Member

@bpasero 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 added a commit that referenced this issue Jan 23, 2020
@bpasero bpasero modified the milestones: January 2020, February 2020 Jan 24, 2020
@bpasero

This comment has been minimized.

Copy link
Member

@bpasero 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/

@nx-giap

This comment has been minimized.

Copy link

@nx-giap 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

This comment has been minimized.

Copy link

@TheFlowerpotMan TheFlowerpotMan commented Feb 12, 2020

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

@vdechenaux

This comment has been minimized.

Copy link

@vdechenaux vdechenaux commented Feb 20, 2020

👍 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 label Feb 21, 2020
@JimAmuro

This comment has been minimized.

Copy link

@JimAmuro JimAmuro 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!

@Happin3ss

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

@JimAmuro JimAmuro 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.

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

@douglascayers douglascayers commented Mar 15, 2020

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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.