From 01490dc1eeb930b802dfe4d9b0d877fb5906a6c8 Mon Sep 17 00:00:00 2001 From: manuaudio Date: Mon, 28 Sep 2026 15:11:49 -0700 Subject: [PATCH 1/3] Sync the Pi theme into PI_CODING_AGENT_DIR when it is set omarchy-theme-set-pi always wrote to ~/.pi/agent, so on a machine that points pi elsewhere with PI_CODING_AGENT_DIR the theme and its settings landed where pi never looks. It now follows that variable, as the Claude and Hermes theme syncs follow CLAUDE_CONFIG_DIR and HERMES_HOME. Fixes #13691 Co-Authored-By: Claude Opus 5.5 --- bin/omarchy-theme-set-pi | 2 +- test/cli | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/omarchy-theme-set-pi b/bin/omarchy-theme-set-pi index b4e6097a9fa1..5cc9f58434e3 100755 --- a/bin/omarchy-theme-set-pi +++ b/bin/omarchy-theme-set-pi @@ -8,7 +8,7 @@ set -euo pipefail CURRENT_THEME_PATH="$HOME/.local/state/omarchy/current/theme" PI_SOURCE_PATH="$CURRENT_THEME_PATH/pi.json" -PI_AGENT_DIR="$HOME/.pi/agent" +PI_AGENT_DIR="${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}" PI_THEME_DIR="$PI_AGENT_DIR/themes" PI_THEME_PATH="$PI_THEME_DIR/omarchy-system.json" PI_SETTINGS_PATH="$PI_AGENT_DIR/settings.json" diff --git a/test/cli b/test/cli index 4081921c4dfb..18072b64cb1e 100755 --- a/test/cli +++ b/test/cli @@ -474,11 +474,11 @@ OMARCHY_PATH="$ROOT" HOME="$PI_TMPDIR" "$ROOT/bin/omarchy-theme-set-templates" jq -e '.name == "omarchy-system" and .vars.custom == "yes"' "$NEXT_THEME/pi.json" >/dev/null pass "theme-specific pi.json overrides the default template" -HOME="$PI_TMPDIR" "$ROOT/bin/omarchy-theme-set-pi" +HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR= "$ROOT/bin/omarchy-theme-set-pi" [[ ! -d $PI_TMPDIR/.pi ]] || fail "pi theme sync skips missing Pi agent when not activating" pass "pi theme sync skips missing Pi agent when not activating" -HOME="$PI_TMPDIR" "$ROOT/bin/omarchy-theme-set-pi" --activate +HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR= "$ROOT/bin/omarchy-theme-set-pi" --activate [[ -f $PI_TMPDIR/.pi/agent/themes/omarchy-system.json ]] || fail "pi theme file is synced" pass "pi theme file is synced" [[ -f $PI_TMPDIR/.pi/agent/settings.json ]] || fail "pi settings file is generated" @@ -490,10 +490,18 @@ pass "pi generated theme is activated" jq '.model = "keep-me"' "$PI_TMPDIR/.pi/agent/settings.json" >"$PI_TMPDIR/settings.json.tmp" mv "$PI_TMPDIR/settings.json.tmp" "$PI_TMPDIR/.pi/agent/settings.json" -HOME="$PI_TMPDIR" "$ROOT/bin/omarchy-theme-set-pi" --activate +HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR= "$ROOT/bin/omarchy-theme-set-pi" --activate jq -e '.theme == "omarchy-system" and .model == "keep-me"' "$PI_TMPDIR/.pi/agent/settings.json" >/dev/null pass "pi theme activation preserves existing settings" +PI_TEST_AGENT_DIR="$PI_TMPDIR/pi-work" +rm -rf "$PI_TMPDIR/.pi" +HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR="$PI_TEST_AGENT_DIR" "$ROOT/bin/omarchy-theme-set-pi" --activate +[[ -f $PI_TEST_AGENT_DIR/themes/omarchy-system.json ]] || fail "pi theme is synced to the configured agent directory" +jq -e '.theme == "omarchy-system"' "$PI_TEST_AGENT_DIR/settings.json" >/dev/null || fail "pi theme is activated in the configured agent directory" +[[ ! -d $PI_TMPDIR/.pi ]] || fail "pi theme sync avoids the default directory when configured" +pass "pi theme sync follows PI_CODING_AGENT_DIR" + jq -e '.name == "Omarchy" and .base == "light" and .overrides.text == "#ffffff"' "$NEXT_THEME/claude.json" >/dev/null pass "claude theme template is generated from standard themed templates" cp "$NEXT_THEME/claude.json" "$CURRENT_THEME/claude.json" From 8559e783c3357f1091b90655b2cc17c924bcd035 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Sat, 3 Oct 2026 11:47:45 +0200 Subject: [PATCH 2/3] Expand a leading ~ in PI_CODING_AGENT_DIR the way pi does pi resolves PI_CODING_AGENT_DIR through its own tilde expansion, so a value like ~/.config/pi set somewhere a shell never expands it is one pi reads from $HOME/.config/pi. The script took it literally: a theme switch found no such directory and skipped the sync, and the install-time --activate created a ~ directory under the working directory and themed that instead. Co-Authored-By: Codex Medium Co-Authored-By: Claude Opus 5.5 --- bin/omarchy-theme-set-pi | 4 ++++ test/cli | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/bin/omarchy-theme-set-pi b/bin/omarchy-theme-set-pi index 5cc9f58434e3..949bdfa02c29 100755 --- a/bin/omarchy-theme-set-pi +++ b/bin/omarchy-theme-set-pi @@ -9,6 +9,10 @@ set -euo pipefail CURRENT_THEME_PATH="$HOME/.local/state/omarchy/current/theme" PI_SOURCE_PATH="$CURRENT_THEME_PATH/pi.json" PI_AGENT_DIR="${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}" +# pi expands a leading ~ in PI_CODING_AGENT_DIR itself, so the value may carry one unexpanded. +if [[ $PI_AGENT_DIR == "~" || $PI_AGENT_DIR == "~/"* ]]; then + PI_AGENT_DIR="$HOME${PI_AGENT_DIR:1}" +fi PI_THEME_DIR="$PI_AGENT_DIR/themes" PI_THEME_PATH="$PI_THEME_DIR/omarchy-system.json" PI_SETTINGS_PATH="$PI_AGENT_DIR/settings.json" diff --git a/test/cli b/test/cli index 18072b64cb1e..5cef1670994f 100755 --- a/test/cli +++ b/test/cli @@ -502,6 +502,12 @@ jq -e '.theme == "omarchy-system"' "$PI_TEST_AGENT_DIR/settings.json" >/dev/null [[ ! -d $PI_TMPDIR/.pi ]] || fail "pi theme sync avoids the default directory when configured" pass "pi theme sync follows PI_CODING_AGENT_DIR" +rm -rf "$PI_TMPDIR/pi-tilde" +(cd "$PI_TMPDIR" && HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR="~/pi-tilde" "$ROOT/bin/omarchy-theme-set-pi" --activate) +jq -e '.theme == "omarchy-system"' "$PI_TMPDIR/pi-tilde/settings.json" >/dev/null || fail "pi theme sync expands a leading ~ in PI_CODING_AGENT_DIR" +[[ ! -e $PI_TMPDIR/~ ]] || fail "pi theme sync expands a leading ~ in PI_CODING_AGENT_DIR" +pass "pi theme sync expands a leading ~ in PI_CODING_AGENT_DIR" + jq -e '.name == "Omarchy" and .base == "light" and .overrides.text == "#ffffff"' "$NEXT_THEME/claude.json" >/dev/null pass "claude theme template is generated from standard themed templates" cp "$NEXT_THEME/claude.json" "$CURRENT_THEME/claude.json" From e5f7265c64f84d10c2456abbc841ca34e6a82656 Mon Sep 17 00:00:00 2001 From: manuaudio Date: Wed, 7 Oct 2026 02:21:02 -0700 Subject: [PATCH 3/3] Test ordinary Pi configured-directory theme sync --- test/cli | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/cli b/test/cli index 5cef1670994f..614e5a51a246 100755 --- a/test/cli +++ b/test/cli @@ -496,6 +496,14 @@ pass "pi theme activation preserves existing settings" PI_TEST_AGENT_DIR="$PI_TMPDIR/pi-work" rm -rf "$PI_TMPDIR/.pi" +mkdir -p "$PI_TEST_AGENT_DIR" +echo '{"model":"keep-me"}' >"$PI_TEST_AGENT_DIR/settings.json" +HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR="$PI_TEST_AGENT_DIR" "$ROOT/bin/omarchy-theme-set-pi" +[[ -f $PI_TEST_AGENT_DIR/themes/omarchy-system.json ]] || fail "pi theme is synced to an existing configured agent directory" +jq -e '.model == "keep-me" and has("theme") == false' "$PI_TEST_AGENT_DIR/settings.json" >/dev/null || fail "ordinary pi theme sync does not activate the theme" +pass "ordinary pi theme sync follows PI_CODING_AGENT_DIR" + +rm -rf "$PI_TEST_AGENT_DIR" HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR="$PI_TEST_AGENT_DIR" "$ROOT/bin/omarchy-theme-set-pi" --activate [[ -f $PI_TEST_AGENT_DIR/themes/omarchy-system.json ]] || fail "pi theme is synced to the configured agent directory" jq -e '.theme == "omarchy-system"' "$PI_TEST_AGENT_DIR/settings.json" >/dev/null || fail "pi theme is activated in the configured agent directory"