Search code examples
ubuntuvisual-studio-codekeyboard-shortcutsvscode-keybindingubuntu-24.04

Many VSCode shortcuts don't work under Ubuntu 24.04.1 LTS


A few days ago I installed a fresh Ubuntu 24.04.1 on my PC alongside with Windows 10. I also installed VSCode (via AppCenter, also tried via VSCode's official website) and noticed, that many shortcuts doesn't work at all or make different actions. For example:

  • Ctrl + 2 should select the second editor. Instead, it splits the window in half
  • Ctrl + Alt + DownArrow should create a new cursor on the next line. Nothing happens

And so on. The keybindings are the same as for Windows. I tried to reinstall, to debug it through "Developer: Toggle Keyboard Shortcuts Troubleshooting" and the logs were OK. For example, for Ctrl + 2 (the action workbench.action.focusSecondEditorGroup was fired):

2024-09-03 12:47:15.782 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-09-03 12:47:15.800 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2024-09-03 12:47:15.800 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
2024-09-03 12:47:15.800 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
2024-09-03 12:47:15.800 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2024-09-03 12:47:16.053 [info] [KeybindingService]: / Soft dispatching keyboard event
2024-09-03 12:47:16.053 [info] [KeybindingService]: | Resolving ctrl+[Digit2]
2024-09-03 12:47:16.054 [info] [KeybindingService]: \ From 1 keybinding entries, matched workbench.action.focusSecondEditorGroup, when: no when condition, source: built-in.
2024-09-03 12:47:16.054 [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: Digit2, keyCode: 50, key: 2
2024-09-03 12:47:16.054 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: Digit2, keyCode: 23 ('2')
2024-09-03 12:47:16.055 [info] [KeybindingService]: | Resolving ctrl+[Digit2]
2024-09-03 12:47:16.055 [info] [KeybindingService]: \ From 1 keybinding entries, matched workbench.action.focusSecondEditorGroup, when: no when condition, source: built-in.
2024-09-03 12:47:16.055 [info] [KeybindingService]: + Invoking command workbench.action.focusSecondEditorGroup.
2024-09-03 12:47:16.306 [info] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.

I tried to google for it but there was nothing much. The closest to find was this: https://github.com/microsoft/vscode/issues/212430 And nothing from there worked.

  • Ubuntu: 24.04.1
  • VSCode: 1.92.2

Has anyone encountered the same issue? Thank you!


Solution

  • Ubuntu uses some keybindings for dynamic workspaces. Ctrl + Alt + DownArrow is used for switch-to-workspace-down. You can change it with dconf or terminal commands.

    See https://stackoverflow.com/a/50373094/2073776