1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 23:42:51 -05:00

matugen: fix wallpaperengine color generation

This commit is contained in:
bbedward
2025-10-29 15:41:10 -04:00
parent e1785a1738
commit 1478c92f49

View File

@@ -111,12 +111,12 @@ Singleton {
console.info("Theme: Matugen now available, regenerating colors for dynamic theme") console.info("Theme: Matugen now available, regenerating colors for dynamic theme")
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode)
const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default" const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default"
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot" const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot"
if (rawWallpaperPath.startsWith("#")) { const effectivePath = rawWallpaperPath.startsWith("we:") ? (stateDir + "/we_screenshots/" + rawWallpaperPath.substring(3) + ".jpg") : rawWallpaperPath
setDesiredTheme("hex", rawWallpaperPath, isLight, iconTheme, selectedMatugenType) if (effectivePath.startsWith("#")) {
setDesiredTheme("hex", effectivePath, isLight, iconTheme, selectedMatugenType)
} else { } else {
setDesiredTheme("image", rawWallpaperPath, isLight, iconTheme, selectedMatugenType) setDesiredTheme("image", effectivePath, isLight, iconTheme, selectedMatugenType)
} }
return return
} }
@@ -126,12 +126,12 @@ Singleton {
if (currentTheme === dynamic) { if (currentTheme === dynamic) {
if (rawWallpaperPath) { if (rawWallpaperPath) {
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot" const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot"
if (rawWallpaperPath.startsWith("#")) { const effectivePath = rawWallpaperPath.startsWith("we:") ? (stateDir + "/we_screenshots/" + rawWallpaperPath.substring(3) + ".jpg") : rawWallpaperPath
setDesiredTheme("hex", rawWallpaperPath, isLight, iconTheme, selectedMatugenType) if (effectivePath.startsWith("#")) {
setDesiredTheme("hex", effectivePath, isLight, iconTheme, selectedMatugenType)
} else { } else {
setDesiredTheme("image", rawWallpaperPath, isLight, iconTheme, selectedMatugenType) setDesiredTheme("image", effectivePath, isLight, iconTheme, selectedMatugenType)
} }
} }
} else { } else {
@@ -148,7 +148,6 @@ Singleton {
} }
if (primaryColor) { if (primaryColor) {
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
setDesiredTheme("hex", primaryColor, isLight, iconTheme, matugenType) setDesiredTheme("hex", primaryColor, isLight, iconTheme, matugenType)
} }
} }
@@ -812,11 +811,12 @@ Singleton {
const desiredPath = stateDir + "/matugen.desired.json" const desiredPath = stateDir + "/matugen.desired.json"
Quickshell.execDetached(["sh", "-c", `mkdir -p '${stateDir}' && cat > '${desiredPath}' << 'EOF'\n${json}\nEOF`]) Quickshell.execDetached(["sh", "-c", `mkdir -p '${stateDir}' && cat > '${desiredPath}' << 'EOF'\n${json}\nEOF`])
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
workerRunning = true workerRunning = true
const syncModeWithPortal = (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal) ? "true" : "false" const syncModeWithPortal = (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal) ? "true" : "false"
if (rawWallpaperPath.startsWith("we:")) { if (rawWallpaperPath.startsWith("we:")) {
console.log("Theme: Starting matugen worker (WE wallpaper)") console.log("Theme: Starting matugen worker (WE wallpaper, waiting for screenshot)")
systemThemeGenerator.command = ["sh", "-c", `sleep 1 && ${shellDir}/scripts/matugen-worker.sh '${stateDir}' '${shellDir}' '${configDir}' '${syncModeWithPortal}' --run`] systemThemeGenerator.command = ["sh", "-c", `sleep 3 && ${shellDir}/scripts/matugen-worker.sh '${stateDir}' '${shellDir}' '${configDir}' '${syncModeWithPortal}' --run`]
} else { } else {
console.log("Theme: Starting matugen worker") console.log("Theme: Starting matugen worker")
systemThemeGenerator.command = [shellDir + "/scripts/matugen-worker.sh", stateDir, shellDir, configDir, syncModeWithPortal, "--run"] systemThemeGenerator.command = [shellDir + "/scripts/matugen-worker.sh", stateDir, shellDir, configDir, syncModeWithPortal, "--run"]
@@ -837,10 +837,11 @@ Singleton {
return return
} }
const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot" const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot"
if (rawWallpaperPath.startsWith("#")) { const effectivePath = rawWallpaperPath.startsWith("we:") ? (stateDir + "/we_screenshots/" + rawWallpaperPath.substring(3) + ".jpg") : rawWallpaperPath
setDesiredTheme("hex", rawWallpaperPath, isLight, iconTheme, selectedMatugenType) if (effectivePath.startsWith("#")) {
setDesiredTheme("hex", effectivePath, isLight, iconTheme, selectedMatugenType)
} else { } else {
setDesiredTheme("image", rawWallpaperPath, isLight, iconTheme, selectedMatugenType) setDesiredTheme("image", effectivePath, isLight, iconTheme, selectedMatugenType)
} }
} else { } else {
let primaryColor let primaryColor