tl;dr: I can’t find if there is an entry for “is secondary side bar active or not” in vscode.workspace.getConfiguration()
. I want to be able to programmatically check if it’s active.
why and what I did:
I’m a Mac user and want to use native window tabs for VSC. I find them generally preferable, but since VSC doesn’t have control over window decoration anymore, it lacks my favorite button there: secondary status bar toggle.
I know about ⌥⌘B shortcut but I still want a button, don’t judge. I don’t want to use custom title bar either because having two titlebars is weird.
So, I’ve decided to create an extension that puts a button in status bar that calls workbench.action.toggleAuxiliaryBar
when clicked. I also want to update the icon (just the same way I had it in vscode’s window title bar)
I have this piece of code that should do the thing:
function updateStatusBarItem() {
const secSideBarConfig = vscode.workspace.getConfiguration("workbench").get("???")
const isSidebarVisible = // ???
statusBarItem.text = isSidebarVisible
? "$(layout-sidebar-right)"
: "$(layout-sidebar-right-off)";
statusBarItem.show();
}
But I can’t find it in getConfiguration("workbench")
, only main sidebar. I don’t see anything regarding it in settings menu. What’s up with that?
I also need to call this update function when user clicks on a button or toggles secondary side bar some other way. Most reliable way to do this is to listen for configuration changes, like this:
context.subscriptions.push(
vscode.workspace.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration("???")) {
updateStatusBarItem();
}
})
);
but again, I don’t know the config key or if there is a key for it.
I guess right now my only option is to deal with it and use the keyboard shortcut.