From 9f9d2ee5467d0d18c5022f3cdc529c8bd36ebe52 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Thu, 10 Jul 2025 14:04:12 +0200 Subject: [PATCH] feat: Prevent infinite loop of restarts and add dark mode legacy version, b=no-bug, c=common, workspaces --- src/zen/common/ZenUIMigration.mjs | 6 ++++-- src/zen/workspaces/ZenGradientGenerator.mjs | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/zen/common/ZenUIMigration.mjs b/src/zen/common/ZenUIMigration.mjs index 4ee285f62..514fe7e2c 100644 --- a/src/zen/common/ZenUIMigration.mjs +++ b/src/zen/common/ZenUIMigration.mjs @@ -17,6 +17,9 @@ class nsZenUIMigration { } } this.clearVariables(); + if (this.shouldRestart) { + Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart); + } } get _migrationVersion() { @@ -59,8 +62,7 @@ class nsZenUIMigration { if (userChromeFile.exists() || userContentFile.exists()) { Services.prefs.setBoolPref('toolkit.legacyUserProfileCustomizations.stylesheets', true); console.log('ZenUIMigration: User stylesheets detected, enabling legacy stylesheets.'); - Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart); - return; + this.shouldRestart = true; } } diff --git a/src/zen/workspaces/ZenGradientGenerator.mjs b/src/zen/workspaces/ZenGradientGenerator.mjs index 59e783fcb..3177d0c19 100644 --- a/src/zen/workspaces/ZenGradientGenerator.mjs +++ b/src/zen/workspaces/ZenGradientGenerator.mjs @@ -1070,6 +1070,10 @@ } else { color = color.c; } + if (this.isLegacyVersion && this.isDarkMode) { + // In legacy version, we blend with white overlay or black overlay based on if we are in dark mode + color = this.blendColors(color, [0, 0, 0], 30); + } return this.blendWithWhiteOverlay(color, opacity); }