Defer compact mode initialization until after delayed startup finishes and update CSS for hover state handling

This commit is contained in:
mr. m
2025-04-11 11:33:03 +02:00
parent 417c6d09bf
commit 1a04cac47c
4 changed files with 25 additions and 8 deletions

View File

@@ -40,8 +40,29 @@
} catch (e) {
console.error('ZenThemeModifier: Error initializing browser layout', e);
}
ZenWorkspaces.promiseInitialized.then(() => {
gZenCompactModeManager.init();
if (gBrowserInit.delayedStartupFinished) {
this.delayedStartupFinished();
} else {
Services.obs.addObserver(this, 'browser-delayed-startup-finished');
}
},
observe(aSubject, aTopic) {
// This nsIObserver method allows us to defer initialization until after
// this window has finished painting and starting up.
if (aTopic == 'browser-delayed-startup-finished' && aSubject == window) {
Services.obs.removeObserver(this, 'browser-delayed-startup-finished');
this.delayedStartupFinished();
}
},
delayedStartupFinished() {
ZenWorkspaces.promiseInitialized.then(async () => {
await delayedStartupPromise;
await SessionStore.promiseAllWindowsRestored;
setTimeout(() => {
gZenCompactModeManager.init();
}, 0);
this.closeWatermark();
});
},

View File

@@ -351,6 +351,7 @@
}
& #zen-appcontent-navbar-container[zen-has-hover],
& #zen-appcontent-navbar-container:hover,
& #zen-appcontent-navbar-container:focus-within,
& #zen-appcontent-navbar-container[zen-user-show],
& #zen-appcontent-navbar-container[has-popup-menu],

View File

@@ -56,9 +56,6 @@ var gZenCompactModeManager = {
});
}
this.preference = this._wasInCompactMode;
if (this._wasInCompactMode) {
document.documentElement.setAttribute('zen-compact-mode', true);
}
},
get preference() {
@@ -66,7 +63,6 @@ var gZenCompactModeManager = {
},
set preference(value) {
console.log((new Error()).stack);
if (this.preference === value || document.documentElement.hasAttribute('zen-compact-animating')) {
// We dont want the user to be able to spam the button
return value;

View File

@@ -983,11 +983,10 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
// If there's ANY pinned tab on the list, we clone the pinned tab
// state to all the tabs
const allArePinned = tabs.every((tab) => tab.pinned);
const allAreEssential = tabs.every((tab) => tab.hasAttribute('zen-essential'));
const thereIsOnePinned = tabs.some((tab) => tab.pinned);
const thereIsOneEssential = tabs.some((tab) => tab.hasAttribute('zen-essential'));
if ((thereIsOneEssential && !allAreEssential) || (thereIsOnePinned && !allArePinned)) {
if (thereIsOneEssential || (thereIsOnePinned && !allArePinned)) {
for (let i = 0; i < tabs.length; i++) {
const tab = tabs[i];
if (tab.pinned) {