diff --git a/src/browser/base/content/ZenCustomizableUI.sys.mjs b/src/browser/base/content/ZenCustomizableUI.sys.mjs index 71c439c12..50716e894 100644 --- a/src/browser/base/content/ZenCustomizableUI.sys.mjs +++ b/src/browser/base/content/ZenCustomizableUI.sys.mjs @@ -47,6 +47,7 @@ export var ZenCustomizableUI = new class { toolbarname="Zen Sidebar Top Buttons" context="toolbar-context-menu" flex="1" + skipintoolbarset="true" customizationtarget="zen-sidebar-top-buttons-customization-target" mode="icons"> @@ -80,10 +81,6 @@ export var ZenCustomizableUI = new class { wrapper.id = 'zen-workspaces-button'; window.document.getElementById('zen-sidebar-icons-wrapper').prepend(wrapper); - window.CustomizableUI.registerToolbarNode( - window.document.getElementById('zen-sidebar-top-buttons') - ); - const panelMenu = window.document.getElementById('PanelUI-menu-button'); panelMenu.classList.add('zen-sidebar-action-button'); panelMenu.setAttribute('cui-areatype', 'toolbar'); @@ -97,10 +94,6 @@ export var ZenCustomizableUI = new class { elem.setAttribute('removable', 'true'); } - window.CustomizableUI.registerToolbarNode( - window.document.getElementById('zen-sidebar-icons-wrapper') - ); - this._moveWindowButtons(window); } @@ -129,4 +122,13 @@ export var ZenCustomizableUI = new class { } } } + + registerToolbarNodes(window) { + window.CustomizableUI.registerToolbarNode( + window.document.getElementById('zen-sidebar-top-buttons') + ); + window.CustomizableUI.registerToolbarNode( + window.document.getElementById('zen-sidebar-icons-wrapper') + ); + } }; diff --git a/src/browser/base/content/browser-init-js.patch b/src/browser/base/content/browser-init-js.patch index 3b7de3467..1a9a99663 100644 --- a/src/browser/base/content/browser-init-js.patch +++ b/src/browser/base/content/browser-init-js.patch @@ -1,16 +1,25 @@ diff --git a/browser/base/content/browser-init.js b/browser/base/content/browser-init.js -index bee5309c04775adff8652bfe6c54b2d466e821ac..e9741628dcc9eda3500f69441bae293548179e71 100644 +index bee5309c04775adff8652bfe6c54b2d466e821ac..cfeaf7cf2e98c35e76bdd5451f90b004a04d4474 100644 --- a/browser/base/content/browser-init.js +++ b/browser/base/content/browser-init.js -@@ -143,6 +143,7 @@ var gBrowserInit = { +@@ -143,13 +143,15 @@ var gBrowserInit = { gNavToolbox.palette = document.getElementById( "BrowserToolbarPalette" ).content; + ZenCustomizableUI.init(window); for (let area of CustomizableUI.areas) { let type = CustomizableUI.getAreaType(area); - if (type == CustomizableUI.TYPE_TOOLBAR) { -@@ -239,6 +240,10 @@ var gBrowserInit = { +- if (type == CustomizableUI.TYPE_TOOLBAR) { ++ if (type == CustomizableUI.TYPE_TOOLBAR && !area.startsWith("zen-")) { + let node = document.getElementById(area); + CustomizableUI.registerToolbarNode(node); + } + } ++ ZenCustomizableUI.registerToolbarNodes(window); + BrowserSearch.initPlaceHolder(); + + // Hack to ensure that the various initial pages favicon is loaded +@@ -239,6 +241,10 @@ var gBrowserInit = { gPrivateBrowsingUI.init(); BrowserSearch.init(); BrowserPageActions.init(); diff --git a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch index 600b5c952..feba392ff 100644 --- a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch +++ b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs -index 289c3df7dcd6fa6b35681ce61c1e920b6a2651d7..aa7d86770cce41a720e92f63392a763b16381f55 100644 +index 289c3df7dcd6fa6b35681ce61c1e920b6a2651d7..a31dc07c8b756e09f43cd5f81bad8d4a3c5f7fce 100644 --- a/browser/components/customizableui/CustomizableUI.sys.mjs +++ b/browser/components/customizableui/CustomizableUI.sys.mjs @@ -13,6 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, { @@ -19,16 +19,7 @@ index 289c3df7dcd6fa6b35681ce61c1e920b6a2651d7..aa7d86770cce41a720e92f63392a763b const kSpecialWidgetPfx = "customizableui-special-"; -@@ -222,6 +223,8 @@ var CustomizableUIInternal = { - this._updateForNewProtonVersion(); - this._markObsoleteBuiltinButtonsSeen(); - -+ lazy.ZenCustomizableUI.startup(this); -+ - this.registerArea( - CustomizableUI.AREA_FIXED_OVERFLOW_PANEL, - { -@@ -253,10 +256,9 @@ var CustomizableUIInternal = { +@@ -253,13 +254,14 @@ var CustomizableUIInternal = { "spring", "urlbar-container", "spring", @@ -40,6 +31,11 @@ index 289c3df7dcd6fa6b35681ce61c1e920b6a2651d7..aa7d86770cce41a720e92f63392a763b lazy.resetPBMToolbarButtonEnabled ? "reset-pbm-toolbar-button" : null, ].filter(name => name); ++ lazy.ZenCustomizableUI.startup(this); ++ + this.registerArea( + CustomizableUI.AREA_NAVBAR, + { @@ -288,10 +290,10 @@ var CustomizableUIInternal = { { type: CustomizableUI.TYPE_TOOLBAR, @@ -62,7 +58,17 @@ index 289c3df7dcd6fa6b35681ce61c1e920b6a2651d7..aa7d86770cce41a720e92f63392a763b ]); if (AppConstants.platform != "macosx") { toolbars.add(CustomizableUI.AREA_MENUBAR); -@@ -3289,6 +3292,9 @@ var CustomizableUIInternal = { +@@ -1033,6 +1036,9 @@ var CustomizableUIInternal = { + placements = gPlacements.get(area); + } + ++ // remove "zen-sidebar-top-buttons" from the placements ++ placements = placements.filter(p => p != "zen-sidebar-top-buttons"); ++ + // For toolbars that need it, mark as dirty. + let defaultPlacements = areaProperties.get("defaultPlacements"); + if ( +@@ -3289,6 +3295,9 @@ var CustomizableUIInternal = { gSeenWidgets.add(widgetId); } }