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

Keyboard layout changes are not detected on Linux #23690

Closed
chrmarti opened this issue Mar 30, 2017 · 17 comments
Closed

Keyboard layout changes are not detected on Linux #23690

chrmarti opened this issue Mar 30, 2017 · 17 comments
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders keyboard-layout Keyboard layout issues linux Issues with VS Code on Linux verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@chrmarti
Copy link
Contributor

  • VSCode Version: Code - Insiders 1.11.0-insider (6b95480, 2017-03-30T06:18:34.366Z)
  • OS Version: Linux x64 3.13.0-108-generic
  • Extensions: none

Found verifying #1549

Steps to Reproduce on Linux under Parallels with a US keyboard (did not reproduce on Mac):

  1. Start with US layout
  2. Navigate in code to populate navigation history
  3. Navigate back / forward with keyboard shortcut (Ctrl + Alt + Minus, Ctrl + Shift + Minus)
  4. Switch to German layout
  5. Navigate back / forward now works with both the German location of Minus (expected) and the US location of Minus (unexpected)
  6. Reload window
  7. Now navigation only works with the German location of Minus (expected)

It seems like the layout switch doesn't clear out the old binding.

@alexdima alexdima changed the title Mixed keybindings after switching keyboard layout on Linux Keyboard layout changes are not detected on Linux Mar 31, 2017
@alexdima
Copy link
Member

alexdima commented Mar 31, 2017

Yes, keyboard layout changes are not detected on Linux. The workaround is to restart vscode. This method needs to be implemented: https://github.com/Microsoft/node-native-keymap/blob/master/src/keyboard_x.cc#L235

@nicolaslussier
Copy link

restarting VS code dos not make it loar right keybord for shortkut

@alexdima
Copy link
Member

alexdima commented Mar 4, 2019

@nicolaslussier Have you tried the workaround suggested at #24166 (comment)

@Spone
Copy link

Spone commented Aug 5, 2019

I'm having trouble with this, especially because I open VS Code with the French keyboard layout enabled (my OS default), then I switch to US for coding. The Ctrl+Z and Ctrl+W bindings stay on the French keyboard layout which is super frustrating... I haven't found a workaround that helps for now.

@alexdima
Copy link
Member

alexdima commented Aug 5, 2019

@Spone You can reload VS Code F1 > Developer: Reload Window

@Spone
Copy link

Spone commented Aug 5, 2019

Yes, but doing so every time I launch VS Code? 🤣

@alexdima
Copy link
Member

alexdima commented Aug 5, 2019

More possible workarounds:

  • launch code with a script where you change the keyboard layout right before launching via setxkbmap

(or)

  • use keyboard layout independent keybindings (code based). e.g. use the following format in your keybindings.json for those keys that annoy you:
{ "key": "cmd+[KeyZ]", "command": "undo", "when": "textInputFocus && !editorReadonly" },

@Spone
Copy link

Spone commented Aug 5, 2019

Oh, great! The second workaround did the job! Thanks a lot @alexandrudima that was the main pain point while adopting VS Code :)

@lodi-g
Copy link

lodi-g commented Jan 17, 2020

Coming from #88269 .

If it matters, my keyboard layout is set via localectl set-x11-keymap and thus should be correct when X is starting.

X starts my WM, my WM starts VSCode, shouldn't it work?

Thanks

@thibauld
Copy link

thibauld commented Feb 6, 2020

I am switching frequently between EN and FR keyboard. This bug makes VSCode barely usable for me on Ubuntu 18.04.

@GabrielTouron
Copy link

I am using EN and FR keyboards on Ubuntu 18.04. I made a custom alias for the command : setxkbmap fr that I use when I'm switching keyboard. It works for me.
Thank you @alexdima

@jerlam06
Copy link

Exact same issue, cannot find a way to fix.

@jeantil
Copy link

jeantil commented Oct 9, 2020

@alexdima you mention

use keyboard layout independent keybindings (code based). e.g. use the following format in your keybindings.json for those keys that annoy you:
{ "key": "cmd+[KeyZ]", "command": "undo", "when": "textInputFocus && !editorReadonly" },

Since this is not how the default keybindings are defined, I assume that there are drawbacks to this method, can you tell what they are (or why the default keybindings don't use this ? )

thanks

@achertovsky
Copy link

Same issue here. Nothing changed, except update to Version: 1.53.2

@Morikko
Copy link

Morikko commented Mar 31, 2021

"keyboard.dispatch": "keyCode"

This option has solved the problem in the Editor when I changed the keyboard layout once VS code is running. But the shortcuts and the terminal input keep the previous layout.

You can reload VS Code F1 > Developer: Reload Window

This action does nothing to fix the shortcuts or the terminal input. Is there any hard restart command ?
I don't mind losing the terminal, I would just prefer to have all the open workspaces to be open again automatically.

@fonji
Copy link

fonji commented Mar 31, 2021

I would just prefer to have all the open workspaces to be open again automatically.

File > exit (or Ctrl + Q) will quit all windows
Then when you start code again (without any parameter), it restores the latest windows by default.

@pironim
Copy link

pironim commented Apr 5, 2021

ubuntu 16 and latest vs code still an issue.

alexdima added a commit to microsoft/node-native-keymap that referenced this issue Oct 13, 2021
@alexdima alexdima removed the help wanted Issues identified as good community contribution opportunities label Oct 13, 2021
@alexdima alexdima self-assigned this Oct 13, 2021
@alexdima alexdima modified the milestones: Backlog, October 2021 Oct 13, 2021
@alexdima alexdima removed the keybindings VS Code keybinding issues label Oct 13, 2021
alexdima added a commit to microsoft/node-native-keymap that referenced this issue Oct 25, 2021
@alexdima alexdima added the verification-needed Verification of issue is requested label Oct 25, 2021
@TylerLeonhardt TylerLeonhardt added the verified Verification succeeded label Oct 28, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2021
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 insiders-released Patch has been released in VS Code Insiders keyboard-layout Keyboard layout issues linux Issues with VS Code on Linux verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

16 participants