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

Add support for BrowserBack and BrowserForward #28576

Closed
truhlikfredy opened this issue Jun 13, 2017 · 20 comments · Fixed by #135369
Closed

Add support for BrowserBack and BrowserForward #28576

truhlikfredy opened this issue Jun 13, 2017 · 20 comments · Fixed by #135369
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders keybindings VS Code keybinding issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@truhlikfredy
Copy link

  • VSCode Version: 1.13.0
  • OS Version: amd64 Debian 8

Steps to Reproduce:

  1. Have ThinkPad laptop with the next/previous close to the cursor keys
  2. Have custom xmodmapings to map them to F14 and F15 keys

keycode 166=F14
keycode 167=F15

  1. Try to assign these keys to some functions (I get "unknown" instead of naming the shortcut and I can't assign it to the action)
@ramya-rao-a ramya-rao-a added the keybindings VS Code keybinding issues label Jun 13, 2017
@truhlikfredy
Copy link
Author

I think the "unknown" message is the KeyCode.Unknown defined in vs/base/common/keyCodes. But I'm not sure what logic is setting it up, could it be some mismatch with scan codes?

@alexdima
Copy link
Member

@truhlikfredy Could you please try our Keybinding troubleshooting guide -- https://github.com/Microsoft/vscode/wiki/Keybindings#troubleshoot-linux-keybindings

@alexdima alexdima added the info-needed Issue requires more information from poster label Jun 14, 2017
@truhlikfredy
Copy link
Author

truhlikfredy commented Jun 14, 2017

Solved it with workaround in the settings.

"keyboard.dispatch": "keyCode"

But if it's reading original scanCodes, then it should work as well, originally the key are multimedia back / forward (code 166 and 167). Often browsers react to it going to previous website, and actually that was the reason why i remapped it, because I didn't like the original behavior applications had with these keys.

@alexdima
Copy link
Member

Let's continue tracking in #23991 in this case.

@alexdima alexdima added the *duplicate Issue identified as a duplicate of another issue(s) label Jun 15, 2017
@truhlikfredy
Copy link
Author

truhlikfredy commented Jun 15, 2017

#23991 case is for remaps, but in my case it's two different things (obscure keys and remapping), if it would accept the original keycode even ignoring the remaping would be grand as well. If I would remove the remappings, still the visual studio doesn't recognize back/forward keys.

@alexdima
Copy link
Member

I think we recognize F keys up to F19.

@truhlikfredy
Copy link
Author

truhlikfredy commented Jun 15, 2017

Yes, but that is the mapped value, original is this two keys

https://c1.staticflickr.com/8/7277/6863731296_af6a4baf78_b.jpg

And that is not recognised

@alexdima
Copy link
Member

alexdima commented Jun 16, 2017

I can look into adding support in VSCode for them. Can you please press them at https://jsfiddle.net/v1gz5c5m/1/ in Chromium and let me know what values each one has, without any remap magic (xmodmapings).

@truhlikfredy
Copy link
Author

This are the original keys

keydown --- code: BrowserForward, keyCode: 167, key: BrowserForward
keydown --- code: BrowserBack, keyCode: 166, key: BrowserBack

@truhlikfredy
Copy link
Author

Can you remove the duplicate tag? Even if this problem is bit overlapping with other issues, but still this one is unique.

@alexdima alexdima removed *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster labels Jun 19, 2017
@alexdima alexdima reopened this Jun 19, 2017
@alexdima alexdima changed the title Atypical keyboard shortcuts are not supported Add support for BrowserBack and BrowserForward Jun 19, 2017
@alexdima alexdima added the feature-request Request for new features or functionality label Jun 19, 2017
@alexdima alexdima modified the milestones: Backlog, On Deck Jun 19, 2017
@antcodd
Copy link

antcodd commented Jun 23, 2017

How exactly did you manage to work around this issue? I don't see any way in keybindings.json to specify a keyCode or code and the keybindings editor shows unknown. Perhaps it works for you specially because you are using F14 and F15 and not the native back/forward keys?

The current keybinding design in vscode seems limiting. Why doesn't it just support the names from "code" when keyboard.dispatch=code mode?

Changing keyboard.dispatch to keyCode didn't seem to make a difference for me.

Somewhat related issue: #8641, the same issue for the mouse button equivalent (which I don't believe send keycodes on Linux).

@truhlikfredy
Copy link
Author

Yes that what I said it works with me because I used xmodmap to map them to F14 and F15 and then added this to vscode settings:

"keyboard.dispatch": "keyCode"

Just because I have workaround it doesn't mean it's not an issue so that's why I asked to remove the "duplicate tag" etc...

I looked at the source code and the keyboard management seems too complicated without much gain. Plus now it doesn't respect the remaps which is probably the first application I have seen and has issues with this.

To debug what you get from your linux I like to use

xev

It shows exactly what events you are emitting (keyboard, mouse etc...)

@alexdima
Copy link
Member

alexdima commented Jun 23, 2017

Keyboard management is complicated because it needs to work correctly in:

  • VSCode on Windows (based on Chromium + native-keymap to present correct labels to the UI) -- uses keyCode to act the same as all other Windows native applications
  • VSCode on Linux (based on Chromium + native-keymap to bind our default US based keybindings to something different depending on the keyboard layout and to present correct labels in the UI) -- uses code by default
  • VSCode on OSX (based on Chromium + native-keymap to bind our default US based keybindings to something different depending on the keyboard layout and to present correct labels in the UI) -- uses code by default
  • Monaco Editor on Chrome on Windows/OSX/Linux -- uses keyCode
  • Monaco Editor on Firefox on Windows/OSX/Linux -- uses keyCode
  • Monaco Editor on IE11 and Edge on Windows -- uses keyCode
  • Monaco Editor on Safari on OSX -- uses keyCode

@truhlikfredy
Copy link
Author

truhlikfredy commented Jun 23, 2017

Wow, that is impressive, didn't know the Monaco Editor is based on this as well, then not really surprised of the over-complications. It needs to be universal and consider many different combinations.

@alexdima alexdima removed this from the On Deck milestone Apr 17, 2018
@alexdima alexdima added this to the Backlog milestone Apr 17, 2018
@alexdima alexdima removed their assignment Apr 20, 2018
@jomel
Copy link

jomel commented Mar 14, 2019

Just to say I also have this exact issue.
My keyboard has standalone keys for browser Back and browser forward, that I wanted to use for code folding, but they come up as "unknown" in vscode.
I used the workaround described by @truhlikfredy to assign my keys for F13 & F14.
For anybody else facing the same (on Ubuntu), here is the workaround:

  • In vscode open key bindings (ctrl P & "leyboard shortcuts"),
  • click the "record keys" button the right of the input box
  • press your key. it will sau "unknown" in the box, but if you hover over that word ift will say something like "code: BrowserBack", keyCode:166, key: "
  • in terminal run: xmodmap -pke > ~/xmodmap_original : this backup up your current keymap.
  • in terminal run: echo "keycode 166 = F13 F13 F13" => ~/.Xmodmap : this maps your new key binding
  • (for good measure) run xmodmap ~/.Xmodmap
  • In vscode open settings (ctrl P & "settings", choose "open settings JSON") & add "keyboard.dispatch": "keyCode"
  • youshould now be able to go back to the vscode key bindings editor & use your new key

@AntonKrug
Copy link
Member

It stopped working on me recently as it looks like vscode update reset some settings. I forgot I was making this issue and by accident googled my own solution, in this case the "keyboard.dispatch" got reset to default value so I had to set it back to the "keyCode" value.

I have modified other editors, even rebuild chromium from scratch to support the F13/F14 as previous and next tabs, physically these buttons are located close to the cursor arrows and it's very pleasant to have editors/browsers setup so the whole UI is consistent and productive.

@rzhao271
Copy link
Contributor

rzhao271 commented Oct 27, 2021

I'm not sure how to verify this issue. I tried connecting my mouse, which has back and forward buttons, but pressing those buttons, even while trying to set the shortcut, results in the tab switching.

@rzhao271 rzhao271 added the verification-steps-needed Steps to verify are needed for verification label Oct 27, 2021
@alexdima
Copy link
Member

alexdima commented Oct 27, 2021

To verify, you would need a keyboard with media keys which has a browser back key e.g.

image

@alexdima alexdima added author-verification-requested Issues potentially verifiable by issue author and removed verification-steps-needed Steps to verify are needed for verification labels Oct 27, 2021
@joaomoreno
Copy link
Member

Verified by remapping a key to browserback: https://www.lifewire.com/remap-keyboard-in-windows-10-5181178

@joaomoreno joaomoreno added the verified Verification succeeded label Oct 29, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders keybindings VS Code keybinding issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants