mirror of
https://github.com/zen-browser/desktop.git
synced 2026-02-05 19:37:22 +00:00
fix: Fix ZenWorkspaces initialization in hidden windows and private browsing mode
This commit is contained in:
@@ -165,3 +165,6 @@ pref('zen.splitView.working', false);
|
||||
|
||||
// Zen Workspaces
|
||||
pref('zen.workspaces.enabled', true);
|
||||
|
||||
// Zen Watermark
|
||||
pref('zen.watermark.enabled', true);
|
||||
|
||||
@@ -3,10 +3,11 @@ var ZenWorkspaces = {
|
||||
async init() {
|
||||
let docElement = document.documentElement;
|
||||
if (docElement.getAttribute("chromehidden").includes("toolbar")
|
||||
|| docElement.getAttribute("chromehidden").includes("menubar")) {
|
||||
|| docElement.getAttribute("chromehidden").includes("menubar")
|
||||
|| docElement.hasAttribute("privatebrowsingmode")) {
|
||||
console.log("!!! ZenWorkspaces is disabled in hidden windows !!!");
|
||||
return; // We are in a hidden window, don't initialize ZenWorkspaces
|
||||
}
|
||||
}
|
||||
console.log("Initializing ZenWorkspaces...");
|
||||
await this.initializeWorkspaces();
|
||||
console.log("ZenWorkspaces initialized");
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
diff --git a/browser/base/content/browser-init.js b/browser/base/content/browser-init.js
|
||||
index a79a9734619f89639c15087fe28e9615354a7209..212628c6fb2bed5ba17a3d2908f5d4b2376fa95e 100644
|
||||
index a79a9734619f89639c15087fe28e9615354a7209..b7e6a413e02ed047e19de1db3866087a1fdc5c4a 100644
|
||||
--- a/browser/base/content/browser-init.js
|
||||
+++ b/browser/base/content/browser-init.js
|
||||
@@ -230,6 +230,8 @@ var gBrowserInit = {
|
||||
gURLBar.readOnly = true;
|
||||
}
|
||||
|
||||
@@ -237,6 +237,9 @@ var gBrowserInit = {
|
||||
gPrivateBrowsingUI.init();
|
||||
BrowserSearch.init();
|
||||
BrowserPageActions.init();
|
||||
+
|
||||
+ Services.scriptloader.loadSubScript("chrome://browser/content/zenThemeModifier.js", this);
|
||||
+
|
||||
// Misc. inits.
|
||||
gUIDensity.init();
|
||||
TabletModeUpdater.init();
|
||||
+
|
||||
if (gToolbarKeyNavEnabled) {
|
||||
ToolbarKeyboardNavigator.init();
|
||||
}
|
||||
|
||||
@@ -128,13 +128,20 @@
|
||||
let profile = ProfileService.currentProfile;
|
||||
if (!profile || profile.zenAvatarPath == "") return;
|
||||
// TODO: actually use profile data to generate the avatar, instead of just using the name
|
||||
console.log("ZenThemeModifier: setting avatar image to", profile.zenAvatarPath);
|
||||
mainWindowEl.style.setProperty("--zen-avatar-image-url", `url(${profile.zenAvatarPath})`);
|
||||
let avatarUrl = profile.zenAvatarPath;
|
||||
if (document.documentElement.hasAttribute("privatebrowsingmode")) {
|
||||
avatarUrl = "chrome://global/skin/icons/indicator-private-browsing.svg";
|
||||
}
|
||||
console.log("ZenThemeModifier: setting avatar image to", avatarUrl);
|
||||
mainWindowEl.style.setProperty("--zen-avatar-image-url", `url(${avatarUrl})`);
|
||||
mainWindowEl.style.setProperty("--avatar-image-url", `var(--zen-avatar-image-url)`, "important");
|
||||
this.closeWatermark();
|
||||
},
|
||||
|
||||
openWatermark() {
|
||||
if (!Services.prefs.getBoolPref("zen.watermark.enabled", false)) {
|
||||
return;
|
||||
}
|
||||
const watermark = document.getElementById("zen-watermark");
|
||||
if (watermark) {
|
||||
watermark.removeAttribute("hidden");
|
||||
|
||||
@@ -334,6 +334,10 @@ toolbarbutton#scrollbutton-up {
|
||||
background: var(--toolbarbutton-hover-background);
|
||||
}
|
||||
|
||||
#private-browsing-indicator-with-label {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.tabbrowser-tab::after {
|
||||
background: var(--identity-tab-color, transparent);
|
||||
border-radius: 2px;
|
||||
@@ -607,7 +611,7 @@ panelmultiview {
|
||||
|
||||
#zen-watermark[hidden="true"] {
|
||||
transition: 0.6s;
|
||||
transition-delay: 1.5s;
|
||||
transition-delay: .5s;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user