Skip to content

Handle keybindings when editor is not focused #9231

Closed Answered by gurbindersingh
gurbindersingh asked this question in Q&A
Discussion options

You must be logged in to vote

I am not sure if this is the recommended solution but I found out that you can define multi-chord keybindings directly in the keyboard shortcuts JSON file (it does not work through the GUI). For example something like this

{
  "key": "space e e",
  "command": "workbench.action.toggleSidebarVisibility",
  "when": "sideBarFocus"
},

works. Though the when expression is important in this case because otherwise the Space key will stop doing its job as VS Code will expect you to be triggering a keyboard shortcut whenever you press Space.
Hopefully this helps someone else looking for a solution.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gurbindersingh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant