Vscode: macOS: Allow mouse buttons 4 and 5 to navigate history

Created on 1 Jul 2016  ·  100Comments  ·  Source: microsoft/vscode

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

feature-request fixed-in-electron-7 mac upstream upstream-issue-linked verification-needed verified workbench-history

Most helpful comment

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

All 100 comments

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

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

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

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)

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

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

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

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

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

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?

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!

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 

@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…)

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

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

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

@luispabon

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

😂

;)

@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

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.

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 https://github.com/electron/electron/issues/6996

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.

Is there a way to disable the back and forward mouse buttons from navigating on Windows, or are disabling these buttons tied to the electron issue mentioned above?

As other's have mentioned (at least on Windows), I can go into my mouse's software configuration (in my case Logitech's SetPoint Settings software), and assign a keystroke assignment to the buttons. In my case I reassigned the back button to 'Alt+Left' for VS Code. The cool thing is that now navigates backward in code location as I desired, yet also still retains native functionality around the rest of the OS like in the browser still allowing it to go back in the history. Kind of gives me the best of both worlds.

Any news on this issue? All software editors that I use in Linux do support out of the box forward-back navigation with the forward-back buttons of the mouse. Why wouldn't VS Code do the same?

@JoseFMP because VSCode is written in Electron and electron doesn't support this within the window by default. Would love to see this adapted in VSCode for Linux as well.

Meanwhile I was able to configure it using xbindkeys and xdotool as @aapocketz mentioned above. Though I have the configs set without the CTRL key, and in current vscode version different keys go back/forth than the ones mentioned by @aapocketz :

"xdotool key --clearmodifiers control+alt+minus"
    b:8
"xdotool key --clearmodifiers control+shift+minus"
    b:9

xbindkeys reference: http://xahlee.info/linux/linux_xbindkeys_tutorial.html

The electron version of this bug has been closed as there already being a way to achieve mouse navigation functionality with electron. https://github.com/electron/electron/issues/6996#issuecomment-423873660
Could this be implemented in VSCode as well?
Please understand that this is a severely annoying issue, given that it's a standard and habituated functionality in desktop applications. There should be no need for user configuration or shady workarounds, it should work by default.

super annoying that this doesn't work, and working around with xbindkeys breaks back/forward in the other apps that do listen correctly for the mouse buttons, not to mention that wayland is quickly becoming standard

I'm in fact suprised that code vscode, so popular and feature packed editor requires to use xbindkeys hacks to provide mouse-buttons navigation...

Any news on this issue? i.e. it was closed because of another issue? but the other issue has no content at all.

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

You've changed my life!

Any update on this feature?
We need it on Mac osx!

The fix for Linux is great, and not a hack IMO. FYI I had to switch b9/b8 to get navigation going in the proper direction.

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

For Wayland you can use evemu for super complicated remap:

Listening for Mouse Button Press

Find your mouse & keyboard ids with sudo evemu-describe (no devices if not root):

$ sudo evemu-describe 
Available devices:
/dev/input/event0:  Sleep Button
/dev/input/event1:  Lid Switch
/dev/input/event2:  Power Button
/dev/input/event3:  Power Button
/dev/input/event4:  AT Translated Set 2 keyboard
...
/dev/input/event14: PS/2 Generic Mouse
...

My Laptop mouse buttons are of device /dev/input/event14, the keyboard is /dev/input/event4.

In this i simply remap the left mouse button ALT-Left, so step-by-step:
Listen for mouse events with sudo evemu-record /dev/input/event14 will print a lot and then when you click the left mouse button:

E: 0.000001 0001 0110 0001  # EV_KEY / BTN_LEFT             1
E: 0.000001 0000 0000 0000  # ------------ SYN_REPORT (0) ---------- +0ms
E: 0.036297 0001 0110 0000  # EV_KEY / BTN_LEFT             0
E: 0.036297 0000 0000 0000  # ------------ SYN_REPORT (0) ---------- +36ms

Pressing the mouse button: BTN_LEFT 1
and releasing it 36ms later: BTN_LEFT 0

So lets filter the stream for release events:

sudo evemu-record /dev/input/event14 | grep --line-buffered "BTN_LEFT.*0" | while read ; do echo Left Mouse Button released! ; done

This will print _Left Mouse Button released!_ everytime you release the left mouse button.

Doing the Keystrokes

Now, we need to change the echo to an actually key press. The keyboard is device /dev/input/event4.
For the key combination, we basically do:

  • Alt down
  • Left down
  • Left up
  • Alt up

which can be done with evemu by executing:

evemu-event /dev/input/event4 --type EV_KEY --code KEY_LEFTALT --value 1 --sync; 
evemu-event /dev/input/event4 --type EV_KEY --code KEY_LEFT --value 1 --sync;
evemu-event /dev/input/event4 --type EV_KEY --code KEY_LEFT --value 0 --sync; 
evemu-event /dev/input/event4 --type EV_KEY --code KEY_LEFTALT --value 0 --sync;

Final command

Putting the mouse button listener and the keypress commands together, leads to this script, which will always press alt-left when the left mouse button is pressed:

evemu-record /dev/input/event14 | grep --line-buffered "BTN_LEFT.*0" | while read ; do bash -evemu 'c-event /dev/input/event4 --type EV_KEY --code KEY_LEFTALT --value 1 --sync; evemu-event /dev/input/event4 --type EV_KEY --code KEY_LEFT --value 1 --sync; evemu-event /dev/input/event4 --type EV_KEY --code KEY_LEFT --value 0 --sync; evemu-event /dev/input/event4 --type EV_KEY --code KEY_LEFTALT --value 0 --sync' ; done

Put in in a script, e.g., mouse_back.sh and execute with sudo sudo ./mouse_back.sh to remap your mouse button.

Mapping the mouse buttons to key presses is really a big hack. It takes me back to the days where scroll wheels weren't supported in Linux, and you had to bind it to keys. Depending on the context/focus of the application, weird stuff would happen.

For instance, alt-left and alt-right produce characters in my _Konsole_.

And what happens to applications that do listen to the events? They can't anymore.

The fix for Linux is great, and not a hack IMO. FYI I had to switch b9/b8 to get navigation going in the proper direction.

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

You think globally intercepting mouse button presses and mapping them to keyboard presses to get navigation to work on basically the only application that doesn't recognize these buttons - isn't hacky enough? If you are looking for a more hacky solution, you could superglue some coat hanger wire to the mouse buttons and have them tip some sort of pendulum which would weigh down the proper keys on the keyboard you are using. When using other applications just put a rubber band on the coat hangers to keep them from pressing the keys. Pretty simple solution and all you need is some basic office supplies. This solution would be perfect for someone dual booting as it would work in any OS.

Also, xdo-tool won't work for Wayland.

On Fri, Jan 18, 2019 at 1:24 PM aapocketz notifications@github.com wrote:

The fix for Linux is great, and not a hack IMO. FYI I had to switch b9/b8
to get navigation going in the proper direction.

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

You think globally intercepting mouse button presses and mapping them to
keyboard presses to get navigation to work on basically the only
application that doesn't recognize these buttons - isn't hacky enough? If
you are looking for a more hacky solution, you could superglue some coat
hanger wire to the mouse buttons and have them tip some sort of pendulum
which would weigh down the proper keys on the keyboard you are using. When
using other applications just put a rubber band on the coat hangers to keep
them from pressing the keys. Pretty simple solution and all you need is
some basic office supplies. This solution would be perfect for someone dual
booting as it would work in any OS.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/8641#issuecomment-455544596,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGF8V2WYKYOpCox4JLUGFqLkxhiE6i7Uks5vEcsggaJpZM4JDchS
.

>

Kind regards,
Luis Pabon

Still no solution for this issue? Really usability problem. And the worst is that is ignore only for Linux.

Just side note: I've got MacOS and Logitech mouse and I am able to solve/workaround this problem only with Logitech Options application.
All buttons on mouse are customizable, so when you choose in Logitech Options: Mouse -> Back button -> Keystroke assignment -> Ctrl + - then your back button will work as expected.
And simillary with Forward button...

Then try using them in your browser, and your font size will change (if you really did mean ctrl +/-).

Then try using them in your browser, and your font size will change (if you really did mean ctrl +/-).

Unfortunately no :)
You have to change it in All Applications -> Application Specific settings. Then select only VS Code application.

Another equivalent for Linux:

Use Easystroke Gesture Recognition to remap Back/Forward buttons to Go Back and Go Forward shortcuts. Make sure those shortcuts work to start with! I had to change mine in the User settings.

I've subscribed to this issue just to learn when it'll be fixed, and not for 100 ways to break your forward/backward mouse buttons :crying_cat_face:

Has anyone tried out this extension, it sounds good; I know it's not out of the box native, but if it fixes the problem [for now] I say use it! :)
https://marketplace.visualstudio.com/items?itemName=SamHarwell.MouseNavigation

I could modify my code on the following app to spawn an additional key press like F13-F20 so you still keep native mouse functionality, but it extends to an additional virtual key press. Unfortunately this doesn't handle the Linux side of things. It's also not a great fix to be running additional software to handle this :(
https://github.com/ctsstc/Discord-Key-Binding-Supression

@ctsstc that extension is for Visual Studio, not VS Code 😕

Damn I was so excited to try that out when I got home, that would explain my confusion about how C# code could run on VSC cross-platform.

I've started trying to use the following which seems to work in many other programs like slack and web browsers.

backwards: ctrl + [
forwards: ctrl + ]

or as others already said too

backwards: ctrl + left arrow
forwards: ctrl + right arrow

I know it doesn't answer the feature request/bug and I still have issues switching between different OS where my mouse works and doesn't -- I'm just too used to navigating with it, it's just convenient. Currently it works on Windows out of the box if I recall correctly. The only way my mouse works on Mac is because it's a Razer and I have to use the software to remap Mouse4 and Mouse5 to "forward" and "backwards" actions. So far I haven't had much luck on Linux unfortunately, but I need to try the methods outlined here, but it sounds like it removes original key functionality unfortunately :[

edit: sounds like vscode needs to implement: https://github.com/jostrander/mouse-forward-back
-- seems like this won't work for everyone as it's x11 and requires the user to install dependencies I believe.

edit2: I feel like it's because some OS see mouse 4/5 explicitly as such and others see it as a "browser back/forward" action/key instead.

Seems like this may be the relevant code which handles browser-backward browser-forward.
https://github.com/Microsoft/vscode/blob/b3e5d256a2f3ef66982990fe074239d058a706f0/src/vs/code/electron-main/window.ts#L456-L468

I think applications like FF/Chrome in Linux understand to listen to both mouse4/5 as well as the browser back/forward events.

So either we need an additional lib added to vscode to handle this due to an electron issue (linked above - not sure what all flavors of Linux it handles) but it sound like electron is not going to fix/handle this unfortunately due to user-space having a package to handle it :

Otherwise you're probably best off looking to rebind the mouse keys from mouse 4/5 to forward/back if you can. I'm not sure if this would have any negative outcome. I considered if you could have it send both events, but then in applications that listen to both you would surely get a double back/forward event going on. The other option would be to map it to a virtual key that often doesn't exist on a physical keyboard which is never used like F13-F20 if you wanted to send out both keystrokes to maintain current functionality.

I took a deep dive into the land of modding x, which I know isn't the full fix we're looking for but the bandaid. At this point I feel defeated; I really thought finding those navigation keys would work : [ I also know I'll just live with this fix and probably never look back.

I was really hoping the following from my research would work using XF86Back and XF86Forward. It worked fine in browsers, but I got no response out of the box with VSCode in the editor like Windows OS works fine with. I tried to bind it in the keyboard settings for giggles. Interestingly enough it did recognize the key, but it didn't actually map to a known VSCode key so it came up as "unknown" which showed the following when you hovered it: code: BrowserBack, keyCode: 166, key: BrowserBack => UI: unknown, user settings: unknown, dispatch: null

I'm not sure if there's another button hiding out there that does this as this is similar to what I have to do on Mac with my Razer mouse. From my twenty tabs I have open I haven't seen anything else it seems : . Maybe someone still has an old keyboard with the forward/back buttons that can log the button that it sends if it normally works for them in VSCode? I imagine it will just be those XF86Back/Forward buttons though.

What I hoped worked

~/.xbindkeysrc

"xdotool key XF86Back"
  b:8
"xdotool key XF86Forward"
  b:9

What does end up working

This is honestly just synonymous to using the arrow keys as well unfortunately. For now since all I do is browse the internet and code this will work for me.

Dependencies

I believe mac has the same brew installs from what I saw.

sudo apt install xbindkeys xdotool

~/.xbindkeysrc

"xdotool key ctrl+bracketleft"
  b:8
"xdotool key ctrl+bracketright"
  b:9

Reload .bindkeysrc

xbindkeys --poll-rc

Ultimately...

We just need VSCode to pick up on these, but that seems to be an issue with Electron that they don't want to fix. Sorry for the spam here.


Don't read past here... unless you want the pain I had.

Research Dump

AutoKey/AutoHotKey Road...

The irony is that they aren't anywhere near parity for implementations x'D

I thought maybe using an AutoHotKey variation for Linux would remap the mouse properly. It seemed to be overkill and not what I wanted.

I was hoping to do something like this From AutoHotkey. I'm not sure if these Browser Back/Forward are the same as the XF86Back/Forward keys I found, but I would have to assume so.

XButton1::Browser_Back
XButton2::Browser_Forward

Hop on the Linux Waggon Fully

@ctsstc thank you :) you saved us hours of research

An extension to what @ctsstc wrote:

Instead of using "ctrl+bracketleft" and "ctrl+bracketright" I would recommend rebinding back and forward in vscode to "alt+Left" and "alt+Right".
This has the big advantage that is this combination is also used by chrome so that the mouse buttons will keep working as expected for that as well.

"xdotool key alt+Left"
  b:8

"xdotool key alt+Right"
  b:9

@jmcadams-r7 A "showstopping bug"? Come on man, take a step back and rethink that. There are multiple workarounds in the meantime, as you yourself have found, so how would this be a showstopper?

No...I'm sticking to my guns on that one...This is Microsoft. It's not some independent 3rd party putting together a college research project. The competition figured this one out at least a year ago. I also don't consider making users download 3rd party paid software (better touch bar) a valid "work around."

I don't know how anyone thinks basic navigation isn't important. I guess if I were working on small 50ish lines of code one-offs, it wouldn't be a big deal. But any code base of moderate complexity requires that the developers jump around between files, which makes this a pretty critical feature.

I shrug, either fix bugs like this or keep pushing developers to other IDEs.

FYI there are keyboard shortcuts for these actions (for me on Linux it's Alt+- for workbench.action.navigateBack and Alt+Shift+- for workbench.action.navigateForward), so it's not like it's impossible to navigate around. I've just been using those shortcuts for now, and consider mouse support a nice-to-have.

Sure this is backed by MS, but it doesn't cost you anything while other IDEs can, this isn't directly making them any money to have a dedicated team that they've put on it, and it's open source so we can make the changes ourselves, or continue using bandaids for the time being. Sure it would be nice to see this make it onto a backlog/roadmap though.

That's all fine, but their indifference on quality of life things like this for the development community is why *nix is taking off as the dev platform of choice. I feel like I'm one of the last MS fanboys, and things like this are why.

@jmcadams-r7 @ctsstc @JoshMcCullough you're all correct...
On the one hand, it's not a big deal when coming from small editors and small projects.

But use IntelliJ for a while and get used to the Ctrl-Click and mouse-back navigation workflow, and going to Code to do a bit of Angular is very jarring.

Electron has added support for Linux to access app-command events (back/forward) for a while now:

This is related to #3130.

This is what i did, if someone is looking for a solution :)

Install xbindkeys:

sudo apt-get install xbindkeys

Install xautomation (using in config xte-command):

sudo apt-get install xautomation

To kill process:

killall xbindkeys

To activate config:

xbindkeys -f ~/.xbindkeysrc

Run to check names for keys and mouse events:

xev

Create/Edit your config file:

nano ~/.xbindkeysrc

"xte 'keydown Control_L' 'keydown Shift_L' 'key minus' 'keyup Control_L' 'keyup Shift_L'"
        b:9
"xte 'keydown Control_L' 'keydown Alt_L' 'key minus' 'keyup Control_L' 'keyup Alt_L'"
        b:8

This is what i did, if someone is looking for a solution :)

@robba86 worked great for me in Fedora too. Thank you!

Back in December there was an update in electron to finally fix the navigation on linux.
When is VSCode incorporating that change?

Back in December there was an update in electron to finally fix the navigation on linux.
When is VSCode incorporating that change?

This electron pullRequest is mentioned in https://github.com/electron/electron/releases/tag/v5.0.0-beta.1
According to the next release plan for vscode https://github.com/Microsoft/vscode/issues/71830 they referred upgrading to electron 4.0.
My guess is that it will come to vscode when electron releases 5.0 and vscode upgrades to 5.0.
So it will take some time :pensive:

2K19... still no mouse button navigation support in VSCode :)

Eh. I went to JetBrains. It's not worth waiting for MS to fix this stuff.

Since there is no solution yet there is another small hack that can be used together with the xbindkeys method that's been mentioned to make sure you can still use back/forward everywhere else.

First you point to other scripts in your .xbindkeysrc (replace buttons/folders as necessary)

".vscode/vscode_back.sh"
    b:8

".vscode/vscode_fwd.sh"
    b:9

Then in those scripts, you detect the active window and only change if it's vscode. This one is for back so you can change the key to XF86Forward for forward.

#!/bin/bash                                                                     
W=`xdotool getactivewindow`
S1=`xprop -id ${W} |awk '/WM_CLASS/{print $4}'`
S2='"Code"'
if [ $S1 = $S2 ]; then
   xdotool key ctrl+alt+minus
else
   xdotool key XF86Back
fi

It would still be nice to eventually have the back button natively supported by VS Code though since this still has a side effect. Normally the back/forward button press (at least for my mouse on Ubuntu 18.04) went to the window under the pointer but with this method it always goes to the active window which could be annoying for people who keep multiple apps visible at the same time.

Note that currently we only support these buttons on Windows. @bpasero

i'm used VSCode and buttons 'MOUSE4','MOUSE3' worked for "go back/forward".

but i switched to VSCode-Insiders and that feature is gone!

I found a fix...use JetBrains on OSX...I wouldn't have tried it had they fixed this issue, but it's a million miles better than VS Code at this point. MS is really dropping the ball lately.

@SupinePandora43 I just installed version 1.36.0 of VSCode, and it does appear that it was indeed broken in this release. Hopefully they can fix this soon because I use that feature extensively and would hate to revert to using alt+left/right.

Please see https://github.com/microsoft/vscode/issues/71318 for support of mouse buttons 4 and 5 for navigation purpose. The recent Electron update broke this feature on Windows it seems, but my fix tries a different approach and should work on Windows and Linux going forward.

To benefit from the fix, you can give our preview releases a try from: https://code.visualstudio.com/insiders/

(it will take a day until the fix is in there)

@vadimcn maybe you could give it a try and then we can close this issue if you feel it works for you.

+1 for linux support.
By the way, thanks always. vscode is awesome.

If people want to give the following builds a try to see if mouse buttons back/forward are working on Windows and Linux:

If people want to give the following builds a try to see if mouse buttons back/forward are working on Windows and Linux:

* Windows: [download](https://az764295.vo.msecnd.net/insider/28988230cd15af27b2da8fa895315eacb1243e79/VSCode-win32-x64-1.37.0-insider.zip)

* Linux: [download](https://az764295.vo.msecnd.net/insider/28988230cd15af27b2da8fa895315eacb1243e79/code-insider-1562303537.tar.gz)

works great here with Ubuntu 18.04, thanks!

If people want to give the following builds a try to see if mouse buttons back/forward are working on Windows and Linux:

Just tested on Ubuntu 16.04 and Ubuntu 18.04. Works! :tada:

Yeah, seems to work in the latest vscode-insiders! (Tested on Ubuntu 18.04)

It now works with 1.36.1 out of the box.
I think we can close this issue now.

Version: 1.36.1
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-08T22:55:08.091Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 5.2.0-arch2-1-ARCH

@k0rn1 also works on windows

Version: 1.37.0-insider (user setup)
Commit: 46cc0a1670b7047e610aaef1bf84f1190802e9ec
Date: 2019-07-11T05:39:48.279Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT ia32 6.1.7601

Working on 1.36.1 in Ubuntu 19.04 via snap.

I'm using 1.36.1 on OSX and still cannot use my mouse button to move foward/backward. Will it be supported in the next version ? Or just for Linux/Windows ?
I'm owning an Intellij IDEA license but still prefer lightweight editor ;).

@Happin3ss

lightweight editor

for reasons implicit to me, vscode is not a lightweight code editor for me, because when I want to create something more (not just change ~ 2 files), everything starts to slow down! This, and the fact that Java support does not work well, I have to use for Java android Studio

@Happin3ss

lightweight editor

for reasons implicit to me, vscode is not a lightweight code editor for me, because when I want to create something more (not just change ~ 2 files), everything starts to slow down! This, and the fact that Java support does not work well, I have to use for Java android Studio

Well It seems you are in the same boat with me. My current project use a Java spring server as back-end services and a React app as client. Whenever have do deal with both, Intellij IDEA is the only option to go. But most of the times I just have to work with React app so I prefer VSCode much more than.
A few reasons behind it included:

  • VSCode setting syncs really well cross-platform. I'm using OSX at my work but a windows station at home.
  • Rich of themes and colorschemes
  • I'm getting a very serious font blurring issue with IDEA when use it on Windows (which doesn't happen with any other IDE/Code Editor). The issue was created on Jetbrains youtrack a couple of months ago and vote up many times by many users but they still cannot figure out where is the root cause and also cannot provide any workaround.

a trick on Mac OS Mojave 10.14.6, vscode 1.37.1.
It works perfectly for me.

paste this in keybindings.json
https://gist.github.com/jihuichoi/42cf86b3610266bd7e35e2f9737b1293

Version: 1.37.1
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:16:34.800Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0

a trick on Mac OS Mojave 10.14.6, vscode 1.37.1.
It works perfectly for me.

paste this in keybindings.json
https://gist.github.com/jihuichoi/42cf86b3610266bd7e35e2f9737b1293

Version: 1.37.1
Commit: f06011a
Date: 2019-08-15T16:16:34.800Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0

Didn't work for me. I also had a quick look in the script and I will be very surprise If it can work :)

Didn't work for me. I also had a quick look in the script and I will be very surprise If it can work :)

I guess it might be different depends on the model of the mouse.
Here's how I made it works. you can find yours, too.

  1. find out what's happening when you click extra buttons of your mouse.
    in my case, indent and outdent.

  2. find the keys which are related 1. actions from default keybindings.json
    for me, cmd+[, cmd+]

  3. finally, remove keys from indent,outdent and bind cmd+[,] to back/forward
    I overwrote them using keybindings.json

If people want to give the following builds a try to see if mouse buttons back/forward are working on Windows and Linux:

What about macOS?

I encourage people using macOS interested in this matter to report an issue to Chrome (http://crbug.com) that mouse buttons 4 and 5 can be detected on macOS platform. That is the only way moving forward on this issue, there is nothing VSCode can do.

I encourage people using macOS interested in this matter to report an issue to Chrome (http://crbug.com) that mouse buttons 4 and 5 can be detected on macOS platform. That is the only way moving forward on this issue, there is nothing VSCode can do.

Pardon me If I misunderstood. This issue/requirement is about allowing to use mouse forward and back for navigation - That's all from user perspective.
And in order to implement this feature, VSCode needs chromium support to do some detection. Technically, I think the one who supposed to implement this feature (VSCode team ? Because I think you already have some idea in mind) is the one who should do the reporting (or maybe feature request) to chromium team. I believed it would potentially open technical discussion how/why, which people not invoked in have no idea about and cannot give detail explanation.
Imagine that I report the issue to chromium team then got the question why you need it ? Am I suppose to say "to support VSCode to do xyz?" :(

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

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

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.

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/

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

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

👍 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.. 😅

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!

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.

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!

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

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.

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: 78a4c91400152c0f27ba4d363eb56d2835f9903a
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

Was this page helpful?
0 / 5 - 0 ratings