1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

matugen: validation

This commit is contained in:
bbedward
2025-11-01 12:04:59 -04:00
parent 89d54dedb7
commit 03d4caff8f
2 changed files with 8 additions and 1 deletions

View File

@@ -811,7 +811,6 @@ Singleton {
const desiredPath = stateDir + "/matugen.desired.json"
Quickshell.execDetached(["sh", "-c", `mkdir -p '${stateDir}' && cat > '${desiredPath}' << 'EOF'\n${json}\nEOF`])
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
workerRunning = true
const syncModeWithPortal = (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal) ? "true" : "false"
if (rawWallpaperPath.startsWith("we:")) {

View File

@@ -41,6 +41,7 @@ LOCK="$STATE_DIR/matugen-worker.lock"
exec 9>"$LOCK"
flock 9
rm -f "$BUILT_KEY"
read_desired() {
[[ ! -f "$DESIRED_JSON" ]] && { echo "no desired state" >&2; exit 0; }
@@ -290,6 +291,13 @@ EOF
SURFACE=$(echo "$JSON_FLAT" | sed -n "s/.*\"surface\" *: *{ *[^}]*\"$mode\" *: *\"\\(#[0-9a-fA-F]\\{6\\}\\)\".*/\\1/p")
fi
if [[ -z "$PRIMARY" ]]; then
echo "Error: Failed to extract PRIMARY color from matugen JSON (mode: $mode)" >&2
echo "This may indicate an incompatible matugen JSON format" >&2
set_system_color_scheme "$mode"
return 2
fi
if command -v ghostty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/ghostty/config-dankcolors" ]]; then
OUT=$("$SHELL_DIR/matugen/dank16.py" "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${HONOR:+--honor-primary "$HONOR"} ${SURFACE:+--background "$SURFACE"} 2>/dev/null || true)
if [[ -n "${OUT:-}" ]]; then