Vscode: Keyboard layout changes are not detected on Linux

Created on 30 Mar 2017  路  13Comments  路  Source: microsoft/vscode

  • VSCode Version: Code - Insiders 1.11.0-insider (6b9548065ad3e31fca4f0e91cf882505fe8c30cf, 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.

feature-request help wanted keybindings keyboard-layout linux

Most helpful comment

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

All 13 comments

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

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

@nicolaslussier Have you tried the workaround suggested at https://github.com/Microsoft/vscode/issues/24166#issuecomment-294002885

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.

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

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

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" },

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

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

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

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

Exact same issue, cannot find a way to fix.

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukehoban picture lukehoban  路  3Comments

villiv picture villiv  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

VitorLuizC picture VitorLuizC  路  3Comments

borekb picture borekb  路  3Comments