Refactor initialization logic in ZenStartup and update tab toolbar handling in ZenUIManager and ZenPinnedTabManager

This commit is contained in:
mr. M
2025-02-14 19:32:56 +01:00
parent 786a377ada
commit 1a293fc5ff
4 changed files with 10 additions and 7 deletions

View File

@@ -3,11 +3,9 @@
var ZenStartup = { var ZenStartup = {
init() { init() {
this.openWatermark(); this.openWatermark();
window.SessionStore.promiseInitialized.then(() => {
this._changeSidebarLocation(); this._changeSidebarLocation();
this._zenInitBrowserLayout(); this._zenInitBrowserLayout();
this._initSearchBar(); this._initSearchBar();
});
}, },
_zenInitBrowserLayout() { _zenInitBrowserLayout() {

View File

@@ -14,7 +14,7 @@ var gZenUIManager = {
return ChromeUtils.importESModule('chrome://browser/content/zen-vendor/motion.min.mjs', { global: 'current' }); return ChromeUtils.importESModule('chrome://browser/content/zen-vendor/motion.min.mjs', { global: 'current' });
}); });
new ResizeObserver(gZenCommonActions.throttle(this.updateTabsToolbar.bind(this), this.sidebarHeightThrottle)).observe( new ResizeObserver(this.updateTabsToolbar.bind(this)).observe(
document.getElementById('TabsToolbar') document.getElementById('TabsToolbar')
); );
@@ -241,7 +241,7 @@ var gZenVerticalTabsManager = {
window.addEventListener('customizationstarting', this._preCustomize.bind(this)); window.addEventListener('customizationstarting', this._preCustomize.bind(this));
window.addEventListener('aftercustomization', this._postCustomize.bind(this)); window.addEventListener('aftercustomization', this._postCustomize.bind(this));
window.addEventListener('MozAfterPaint', updateEvent, { once: true }); this._updateEvent();
if (!this.isWindowsStyledButtons) { if (!this.isWindowsStyledButtons) {
document.documentElement.setAttribute('zen-window-buttons-reversed', true); document.documentElement.setAttribute('zen-window-buttons-reversed', true);
@@ -570,6 +570,7 @@ var gZenVerticalTabsManager = {
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
gZenUIManager.updateTabsToolbar();
this._isUpdating = false; this._isUpdating = false;
}, },

View File

@@ -249,6 +249,7 @@
} }
gBrowser._updateTabBarForPinnedTabs(); gBrowser._updateTabBarForPinnedTabs();
gZenUIManager.updateTabsToolbar();
} }
_onPinnedTabEvent(action, event) { _onPinnedTabEvent(action, event) {

View File

@@ -232,6 +232,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
_organizeTabsToWorkspaceSections(workspace, section, pinnedSection, tabs) { _organizeTabsToWorkspaceSections(workspace, section, pinnedSection, tabs) {
const workspaceTabs = Array.from(tabs).filter((tab) => tab.getAttribute('zen-workspace-id') === workspace.uuid); const workspaceTabs = Array.from(tabs).filter((tab) => tab.getAttribute('zen-workspace-id') === workspace.uuid);
for (const tab of workspaceTabs) { for (const tab of workspaceTabs) {
if (tab.hasAttribute('zen-essential')) {
continue; // Ignore essentials as they need to be in their own section
}
// remove tab from list // remove tab from list
tabs.splice(tabs.indexOf(tab), 1); tabs.splice(tabs.indexOf(tab), 1);
if (tab.pinned) { if (tab.pinned) {