Skip to content

Instantly share code, notes, and snippets.

@pzuraq
Created November 16, 2019 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pzuraq/f9ffe343a8d9bec05e95e1d43c1795b1 to your computer and use it in GitHub Desktop.
Save pzuraq/f9ffe343a8d9bec05e95e1d43c1795b1 to your computer and use it in GitHub Desktop.
VSCode Vertical Tab Bar
let innerWidthDesc = Object.getOwnPropertyDescriptor(window, 'innerWidth');
let getOriginalInnerWidth = innerWidthDesc.get.bind(window);
let setOriginalInnerWidth = innerWidthDesc.set.bind(window);
let VERTICAL_TABS_ENABLED = false;
Object.defineProperty(window, 'innerWidth', {
get() {
if (VERTICAL_TABS_ENABLED) {
return getOriginalInnerWidth() - 200;
}
return getOriginalInnerWidth();
},
set(value) {
setOriginalInnerWidth(value + 200);
}
});
document.body.addEventListener('keydown', (e) => {
if (e.code === 'Minus' && e.metaKey && !e.shiftKey && !e.ctrlKey && !e.altKey) {
e.preventDefault();
e.stopPropagation();
VERTICAL_TABS_ENABLED = !VERTICAL_TABS_ENABLED;
document.body.classList.toggle('vertical-tab-bar-enabled');
let firstTabs = document.querySelector('.title.tabs')
firstTabs.classList.toggle('vertical-tab-bar');
document.querySelector('.monaco-workbench').style.backgroundColor = firstTabs.style.backgroundColor;
window.dispatchEvent(new Event('resize'));
}
}, { capture: true })
.vertical-tab-bar-enabled .part.editor,
.vertical-tab-bar-enabled .part.panel.bottom {
left: 200px;
position: relative;
overflow: visible;
}
.vertical-tab-bar-enabled .part.editor > .content,
.vertical-tab-bar-enabled .part.editor .title.tabs,
.vertical-tab-bar-enabled .monaco-grid-view {
overflow: visible !important;
}
.vertical-tab-bar .tabs-and-actions-container .monaco-scrollable-element {
position: absolute !important;
left: -200px;
height: calc(100vh - 22px) !important;
width: 200px;
z-index: 1000;
}
.vertical-tab-bar .tabs-container {
flex-direction: column;
height: 100% !important;
width: 200px;
}
.vertical-tab-bar .tabs-container > .tab {
min-width: 200px !important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment