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

allow overriding matugen type in custom themes

This commit is contained in:
bbedward
2025-09-21 22:31:45 -04:00
parent f38ffa1de5
commit 81550229e8
4 changed files with 51 additions and 16 deletions

View File

@@ -297,7 +297,8 @@ const StockThemes = {
backgroundText: "#e4e2e3",
outline: "#929092",
surfaceContainer: "#2a2a2a",
surfaceContainerHigh: "#2a2a2b"
surfaceContainerHigh: "#2a2a2b",
matugen_type: "scheme-monochrome"
}
},
LIGHT: {
@@ -486,7 +487,8 @@ const StockThemes = {
backgroundText: "#e4e2e3",
outline: "#929092",
surfaceContainer: "#1f1f21",
surfaceContainerHigh: "#2a2a2b"
surfaceContainerHigh: "#2a2a2b",
matugen_type: "scheme-monochrome"
}
}
}

View File

@@ -505,7 +505,7 @@ Singleton {
}
}
function setDesiredTheme(kind, value, isLight, iconTheme) {
function setDesiredTheme(kind, value, isLight, iconTheme, matugenType) {
if (!matugenAvailable) {
console.warn("matugen not available - cannot set system theme")
return
@@ -515,7 +515,8 @@ Singleton {
"kind": kind,
"value": value,
"mode": isLight ? "light" : "dark",
"iconTheme": iconTheme || "System Default"
"iconTheme": iconTheme || "System Default",
"matugenType": matugenType || "scheme-tonal-spot"
}
const json = JSON.stringify(desired)
@@ -553,21 +554,24 @@ Singleton {
}
} else {
let primaryColor
let matugenType
if (currentTheme === "custom") {
if (!customThemeData || !customThemeData.primary) {
console.warn("Custom theme data not available for system theme generation")
return
}
primaryColor = customThemeData.primary
matugenType = customThemeData.matugen_type
} else {
primaryColor = currentThemeData.primary
matugenType = currentThemeData.matugen_type
}
if (!primaryColor) {
console.warn("No primary color available for theme:", currentTheme)
return
}
setDesiredTheme("hex", primaryColor, isLight, iconTheme)
setDesiredTheme("hex", primaryColor, isLight, iconTheme, matugenType)
}
}
@@ -686,17 +690,20 @@ Singleton {
}
} else {
let primaryColor
let matugenType
if (currentTheme === "custom") {
if (customThemeData && customThemeData.primary) {
primaryColor = customThemeData.primary
matugenType = customThemeData.matugen_type
}
} else {
primaryColor = currentThemeData.primary
matugenType = currentThemeData.matugen_type
}
if (primaryColor) {
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
setDesiredTheme("hex", primaryColor, isLight, iconTheme)
setDesiredTheme("hex", primaryColor, isLight, iconTheme, matugenType)
}
}
}