#!/usr/bin/env bash

# Nomarchy VS Code Theme Setter
# This script only updates the global state.json.
# Home Manager (modules/home/vscode.nix) handles the declarative settings injection.

STATE_DIR="$HOME/.config/nomarchy"
STATE_FILE="$STATE_DIR/state.json"

mkdir -p "$STATE_DIR"
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"

# Theme is already set in state.json by nomarchy-theme-set.
# This script is now mostly a placeholder to maintain the same workflow,
# triggering an env-update if needed to apply the declarative changes.

if [[ $NOMARCHY_TOGGLE_SKIP_VSCODE_THEME != "true" ]]; then
    # We trigger nomarchy-env-update to apply the new VSCode theme declaratively.
    nomarchy-env-update
fi
