feat: Added support for double clicking the resize bar, b=(no-bug), c=common

This commit is contained in:
mr. m
2025-05-01 14:12:55 +02:00
parent 8aa964bc78
commit d845853643
2 changed files with 11 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ export var ZenCustomizableUI = new (class {
}
_addSidebarButtons(window) {
const kDefaultSidebarWidth = '228px';
const toolbox = window.gNavToolbox;
// Set a splitter to navigator-toolbox
@@ -77,9 +78,16 @@ export var ZenCustomizableUI = new (class {
});
// remove all styles except for the width, since we are xulstoring the complet style list
const width = toolbox.style.width || '228px';
const width = toolbox.style.width || kDefaultSidebarWidth;
toolbox.removeAttribute('style');
toolbox.style.width = width;
toolbox.setAttribute('width', width);
splitter.addEventListener('dblclick', (e) => {
if (e.button !== 0) return;
toolbox.style.width = kDefaultSidebarWidth;
toolbox.setAttribute('width', kDefaultSidebarWidth);
});
const newTab = window.document.getElementById('vertical-tabs-newtab-button');
newTab.classList.add('zen-sidebar-action-button');

View File

@@ -793,7 +793,8 @@ var gZenVerticalTabsManager = {
this.recalculateURLBarHeight();
// Always move the splitter next to the sidebar
this.navigatorToolbox.after(document.getElementById('zen-sidebar-splitter'));
const splitter = document.getElementById('zen-sidebar-splitter');
this.navigatorToolbox.after(splitter);
window.dispatchEvent(new Event('resize'));
if (!isCompactMode) {
gZenCompactModeManager.getAndApplySidebarWidth();