From 8be0ca9d43827ebdf2def48cad3be16becbadca9 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 9 Aug 2026 04:22:01 -0700 Subject: [PATCH] Expect Tailscale on the right in the bar defaults test 99293aa gave the Tailscale widget a right defaultSection, but the test still asserted it landed in center after the weather widget, and that dropbox was the first widget after the tray. Anchor both assertions on the tray so they track the placement contract in omarchy-bar rather than hardcoded indexes. Co-Authored-By: Claude Opus 5 (1M context) --- test/shell.d/config-test.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/test/shell.d/config-test.sh b/test/shell.d/config-test.sh index 7ee5a869..09aaa32f 100755 --- a/test/shell.d/config-test.sh +++ b/test/shell.d/config-test.sh @@ -371,9 +371,11 @@ pass "bar defaults restores the stock bar" HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=1 OMARCHY_TEST_TAILSCALE=1 omarchy-bar defaults jq -e ' def ids: map(.id // .); - (.bar.layout.center | ids) as $center | - (.bar.layout.right | ids | index("omarchy.dropbox") == 1) and - ($center | index("omarchy.tailscale") == (($center | index("omarchy.weather")) + 1)) + (.bar.layout.right | ids) as $right | + ($right | index("omarchy.tray")) as $tray | + ($right | index("omarchy.tailscale") == $tray + 1) and + ($right | index("omarchy.dropbox") == $tray + 2) and + (.bar.layout.center | ids | index("omarchy.tailscale") == null) ' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null pass "bar defaults places plugins for running optional services" @@ -382,26 +384,31 @@ HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" \ omarchy-bar defaults jq -e ' def ids: map(.id // .); - (.bar.layout.center | ids) as $center | - (.bar.layout.right | ids | index("omarchy.dropbox") == 1) and - ($center | index("omarchy.tailscale") == (($center | index("omarchy.weather")) + 1)) + (.bar.layout.right | ids) as $right | + ($right | index("omarchy.tray")) as $tray | + ($right | index("omarchy.tailscale") == $tray + 1) and + ($right | index("omarchy.dropbox") == $tray + 2) and + (.bar.layout.center | ids | index("omarchy.tailscale") == null) ' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null pass "bar defaults places service widgets without a running shell" HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=0 OMARCHY_TEST_TAILSCALE=0 omarchy-refresh-shell jq -e ' def ids: map(.id // .); - (.bar.layout.right | ids | index("omarchy.dropbox") == null) and - (.bar.layout.center | ids | index("omarchy.tailscale") == null) + ([.bar.layout.left, .bar.layout.center, .bar.layout.right] | map(ids) | add) as $all | + ($all | index("omarchy.dropbox") == null) and + ($all | index("omarchy.tailscale") == null) ' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null pass "shell refresh keeps optional service widgets absent when services are unavailable" HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=1 OMARCHY_TEST_TAILSCALE=1 omarchy-refresh-shell jq -e ' def ids: map(.id // .); - (.bar.layout.center | ids) as $center | - (.bar.layout.right | ids | index("omarchy.dropbox") == 1) and - ($center | index("omarchy.tailscale") == (($center | index("omarchy.weather")) + 1)) + (.bar.layout.right | ids) as $right | + ($right | index("omarchy.tray")) as $tray | + ($right | index("omarchy.tailscale") == $tray + 1) and + ($right | index("omarchy.dropbox") == $tray + 2) and + (.bar.layout.center | ids | index("omarchy.tailscale") == null) ' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null [[ -f $TMPDIR/home/.local/state/omarchy/restart-shell-called ]] || fail "shell refresh restarts shell" pass "shell refresh places optional service widgets when services are available"