From baa12c01615db6d55ce1ef5ae45241c598ee78e5 Mon Sep 17 00:00:00 2001 From: bbedward Date: Sat, 1 Nov 2025 22:38:56 -0400 Subject: [PATCH] matugen: alt version detection --- scripts/matugen-worker.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/matugen-worker.sh b/scripts/matugen-worker.sh index 73fc2560..6c97cd68 100755 --- a/scripts/matugen-worker.sh +++ b/scripts/matugen-worker.sh @@ -43,6 +43,15 @@ flock 9 rm -f "$BUILT_KEY" +get_matugen_major_version() { + local version_output=$(matugen --version 2>&1) + local version=$(echo "$version_output" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n1) + local major=$(echo "$version" | cut -d. -f1) + echo "$major" +} + +MATUGEN_VERSION=$(get_matugen_major_version) + read_desired() { [[ ! -f "$DESIRED_JSON" ]] && { echo "no desired state" >&2; exit 0; } cat "$DESIRED_JSON" @@ -280,7 +289,7 @@ EOF gsettings set org.gnome.desktop.interface gtk-theme "adw-gtk3-${mode}" >/dev/null 2>&1 || true fi - if echo "$JSON" | grep -qE "\"colors\":\{\"(dark|light)\":\{"; then + if [[ "$MATUGEN_VERSION" == "2" ]]; then PRIMARY=$(echo "$JSON" | sed -n "s/.*\"$mode\":{[^}]*\"primary_container\":\"\\(#[0-9a-fA-F]\\{6\\}\\)\".*/\\1/p") HONOR=$(echo "$JSON" | sed -n "s/.*\"$mode\":{[^}]*\"primary\":\"\\(#[0-9a-fA-F]\\{6\\}\\)\".*/\\1/p") SURFACE=$(echo "$JSON" | sed -n "s/.*\"$mode\":{[^}]*\"surface\":\"\\(#[0-9a-fA-F]\\{6\\}\\)\".*/\\1/p")