Toggle AI Chat Panel with a single shortcut

Is there a way to setup a keybinding to open and close AI chat panel?
When opening, the AI chat panel should show the most recent chat.

This is the keybinding I am using rn:

 {
    "key": "cmd+l",
    "command": "aichat.opensidebar",
    "when": "!activeAIChatEditor || view != workbench.panel.aichat.view"
  },
  {
    "key": "cmd+l",
    "command": "aichat.close-sidebar",
    "when": "activeAIChatEditor || view == workbench.panel.aichat.view"
  },

However, the close-sidebar keybinding doesn’t work when my cursor is in the AI chat editor. What is the way fix it?

1 Like

That’s because you’re focused on the chat input field, which can block some other keybinds. We will work on handling this better. In the meantime, you can try pressing the tab key once to unfocus from the input field and then use your other keybinds.

2 Likes

option + command + B
@Jakob @dnathani

@daaniyaan Yea, but that stops working too when you’re focused on a chat input field.

it’s working for me. @Jakob

CleanShot 2023-11-16 at 16.59.35

Oh, hmm. I tried a bunch of stuff and couldn’t get it to work. I think you’re on MacOS? Maybe it’s different there than on Windows? Not sure.

okay yeah can confirm this works on mac! thanks @daaniyaan
For future reference, the command name in Keyboard shortcuts is “View: Toggle Secondary Side Bar Visibility”.

2 Likes

I had the same problem. Seems like I found a solution.

Set keyboard.dispatch to keyCode in settings.

Yet to be seen if this setting breaks anything. As it is stated that code is recommended…