#!/usr/bin/env bash set -euo pipefail img=$1 # Convert to absolute path to fix symlink issues img=$(realpath "$img") QS_DIR="$HOME/quickshell" mkdir -p "$QS_DIR" LINK="$QS_DIR/current_wallpaper" ln -sf -- "$img" "$LINK" swaybg -m fill -i "$LINK" & disown json="$(matugen image "$img" --json hex)" get() { jq -r "$1" <<<"$json"; } bg=$(get '.colors.dark.background') fg=$(get '.colors.dark.on_background') primary=$(get '.colors.dark.primary') secondary=$(get '.colors.dark.secondary') tertiary=$(get '.colors.dark.tertiary') tertiary_ctr=$(get '.colors.dark.tertiary_container') error=$(get '.colors.dark.error') inverse=$(get '.colors.dark.inverse_primary') bg_b=$(get '.colors.light.background') fg_b=$(get '.colors.light.on_background') primary_b=$(get '.colors.light.primary') secondary_b=$(get '.colors.light.secondary') tertiary_b=$(get '.colors.light.tertiary') tertiary_ctr_b=$(get '.colors.light.tertiary_container') error_b=$(get '.colors.light.error') inverse_b=$(get '.colors.light.inverse_primary') cat >"$QS_DIR/generated_niri_colors.kdl" <"$QS_DIR/generated_ghostty_colors.conf" < "$NOTIFY_FILE" echo "→ Shell notified: $NOTIFY_FILE"