diff --git a/configs/linux/mozconfig b/configs/linux/mozconfig index e4eacfdeb..04eac05b4 100644 --- a/configs/linux/mozconfig +++ b/configs/linux/mozconfig @@ -61,7 +61,7 @@ ac_add_options --enable-alsa ac_add_options --enable-pulseaudio if test "$ZEN_RELEASE"; then - #ac_add_options --enable-clang-plugin + ac_add_options --enable-clang-plugin # Disable DMD and ELF hacks, enable linker lld ac_add_options --disable-dmd diff --git a/src/browser/base/content/ZenUIManager.mjs b/src/browser/base/content/ZenUIManager.mjs index cb61eee03..594d4778f 100644 --- a/src/browser/base/content/ZenUIManager.mjs +++ b/src/browser/base/content/ZenUIManager.mjs @@ -117,6 +117,8 @@ var gZenUIManager = { var gZenVerticalTabsManager = { init() { + this._multiWindowFeature = new ZenMultiWindowFeature(); + ChromeUtils.defineLazyGetter(this, 'isWindowsStyledButtons', () => { return !(window.AppConstants.platform === 'macosx' || window.matchMedia('(-moz-gtk-csd-reversed-placement)').matches || Services.prefs.getBoolPref('zen.view.experimental-force-window-controls-left')); @@ -138,7 +140,7 @@ var gZenVerticalTabsManager = { this.initRightSideOrderContextMenu(); window.addEventListener('customizationstarting', this._preCustomize.bind(this)); - window.addEventListener('aftercustomization', updateEvent); + window.addEventListener('aftercustomization', this._postCustomize.bind(this)); window.addEventListener('DOMContentLoaded', updateEvent, { once: true }); @@ -209,12 +211,22 @@ var gZenVerticalTabsManager = { return this.__actualWindowButtons; }, - _preCustomize() { - this._updateEvent({ forceMultipleToolbar: true }); + async _preCustomize() { + await this._multiWindowFeature.foreachWindowAsActive(async (browser) => { + browser.gZenVerticalTabsManager._updateEvent({ forceMultipleToolbar: true, dontRebuildAreas: true }); + }); + this.rebuildAreas(); this.navigatorToolbox.setAttribute('zen-sidebar-expanded', 'true'); document.documentElement.setAttribute('zen-sidebar-expanded', 'true'); // force expanded sidebar }, + _postCustomize() { + // No need to use `await` here, because the customization is already done + this._multiWindowFeature.foreachWindowAsActive(async (browser) => { + browser.gZenVerticalTabsManager._updateEvent({ dontRebuildAreas: true }); + }); + }, + initializePreferences(updateEvent) { XPCOMUtils.defineLazyPreferenceGetter( this, @@ -261,7 +273,7 @@ var gZenVerticalTabsManager = { ); }, - _updateEvent({ forceMultipleToolbar = false } = {}) { + _updateEvent({ forceMultipleToolbar = false, dontRebuildAreas = false } = {}) { if (this._isUpdating) { return; } @@ -314,16 +326,8 @@ var gZenVerticalTabsManager = { !isCompactMode ) { this.navigatorToolbox.prepend(topButtons); - // browser.prepend(this.navigatorToolbox); - } else { - // customizationTarget.prepend(topButtons); - // tabboxWrapper.prepend(this.navigatorToolbox); } - //if (!isVerticalTabs) { - // document.getElementById("urlbar-container").after(document.getElementById('navigator-toolbox')); - //} - let windowButtons = this.actualWindowButtons; let doNotChangeWindowButtons = !isCompactMode && isRightSide && this.isWindowsStyledButtons; const navBar = document.getElementById('nav-bar'); @@ -365,7 +369,9 @@ var gZenVerticalTabsManager = { document.documentElement.removeAttribute("zen-single-toolbar"); navBar.appendChild(document.getElementById('PanelUI-button')); this._toolbarOriginalParent.prepend(navBar); - this.rebuildAreas(); + if (!dontRebuildAreas) { + this.rebuildAreas(); + } } if (isCompactMode) { diff --git a/src/browser/base/content/zen-styles/zen-workspaces.css b/src/browser/base/content/zen-styles/zen-workspaces.css index 249a4c323..48340aea2 100644 --- a/src/browser/base/content/zen-styles/zen-workspaces.css +++ b/src/browser/base/content/zen-styles/zen-workspaces.css @@ -437,7 +437,7 @@ } } -@media (-moz-bool-pref: 'zen.workspaces.show-workspace-indicator') or (not (-moz-bool-pref: 'zen.workspaces.enabled')) { +@media (not (-moz-bool-pref: 'zen.workspaces.show-workspace-indicator')) or (not (-moz-bool-pref: 'zen.workspaces.enabled')) { #zen-current-workspace-indicator { display: none !important; } diff --git a/src/browser/base/zen-components/ZenCommonUtils.mjs b/src/browser/base/zen-components/ZenCommonUtils.mjs index 4c5c6d37e..4b151ee65 100644 --- a/src/browser/base/zen-components/ZenCommonUtils.mjs +++ b/src/browser/base/zen-components/ZenCommonUtils.mjs @@ -22,12 +22,16 @@ class ZenMultiWindowFeature { return Services.wm.getMostRecentWindow('navigator:browser'); } - isActiveWindow() { + static get isActiveWindow() { return ZenMultiWindowFeature.currentBrowser === window; } + windowIsActive(browser) { + return browser === ZenMultiWindowFeature.currentBrowser; + } + async foreachWindowAsActive(callback) { - if (!this.isActiveWindow()) { + if (!ZenMultiWindowFeature.isActiveWindow) { return; } for (const browser of ZenMultiWindowFeature.browsers) {