I want a behavior that whenever I press "Ctrl+B" it has to toggle the sidebar. If the sidebar becomes visible, then the focus should be on the sidebar. If the sidebar becomes hidden, then the focus should be back in the editor.
I want to avoid pressing ctrl+shift+e (a separate shortcut for focusing on the sidebar) after pressing ctrl+b. This is the same behavior that happens when I toggle a side tool window in Intellij, which I prefer.
I tried putting the below setting in keybindings.json, but it is not working.
{
"command": "runCommands",
"key": "ctrl+b", // keybinding
"args": {
"commands": [
// commands to run in sequence
"workbench.action.togglefocusSideBar",
"workbench.action.toggleSidebarVisibility"
]
}
}
FYI, I tried the above setting after seeing this question: Visual Studio Code keybindings - Running two or more commands with one shortcut