From 48879fb6a087060ffa879c6a0960161f519cf9bc Mon Sep 17 00:00:00 2001 From: "mr. M" Date: Thu, 13 Feb 2025 21:15:55 +0100 Subject: [PATCH] Enhance workspace tab initialization and update tab toolbar on load --- src/browser/base/content/ZenUIManager.mjs | 1 + src/browser/base/zen-components/ZenWorkspaces.mjs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/browser/base/content/ZenUIManager.mjs b/src/browser/base/content/ZenUIManager.mjs index a20dafdef..c4cb657e7 100644 --- a/src/browser/base/content/ZenUIManager.mjs +++ b/src/browser/base/content/ZenUIManager.mjs @@ -27,6 +27,7 @@ var gZenUIManager = { SessionStore.promiseAllWindowsRestored.then(() => { this._hasLoadedDOM = true; + this.updateTabsToolbar(); }); window.addEventListener('TabClose', this.onTabClose.bind(this)); diff --git a/src/browser/base/zen-components/ZenWorkspaces.mjs b/src/browser/base/zen-components/ZenWorkspaces.mjs index 072f7494b..ec56db764 100644 --- a/src/browser/base/zen-components/ZenWorkspaces.mjs +++ b/src/browser/base/zen-components/ZenWorkspaces.mjs @@ -148,7 +148,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { async initializeTabsStripSections() { const perifery = document.getElementById('tabbrowser-arrowscrollbox-periphery'); const tabs = gBrowser.tabContainer.allTabs.filter((tab) => !tab.pinned); - for (const workspace of (await this._workspaces()).workspaces) { + const workspaces = await this._workspaces(); + for (const workspace of workspaces.workspaces) { this._createWorkspaceTabsSection(workspace, tabs, perifery); } if (tabs.length) { @@ -164,6 +165,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { perifery.setAttribute('hidden', 'true'); this._hasInitializedTabsStrip = true; this.registerPinnedResizeObserver(); + this._fixIndicatorsNames(workspaces); } _createWorkspaceSection(workspace) { @@ -526,6 +528,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { this.activeWorkspace = activeWorkspace?.uuid; } } + await this.initializeTabsStripSections(); try { if (activeWorkspace) { window.gZenThemePicker = new ZenThemePicker(); @@ -534,7 +537,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } catch (e) { console.error('ZenWorkspaces: Error initializing theme picker', e); } - await this.initializeTabsStripSections(); } } @@ -1740,7 +1742,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } onPinnedTabsResize(entries) { - if (!this.workspaceEnabled) { + if (!this.workspaceEnabled || !this._hasInitializedTabsStrip) { return; } for (const entry of entries) {