Improve omarchy-config-shell-bar
This commit is contained in:
@@ -144,6 +144,18 @@ HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-config-shell-bar show | jq -e '
|
||||
' >/dev/null
|
||||
pass "shell config shows only bar json"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-config-shell-bar list --json | jq -e '
|
||||
any(.[]; .id == "omarchy.system-stats" and .addable == true and .inBar == false) and
|
||||
all(.[]; .id != "omarchy.tailscale")
|
||||
' >/dev/null
|
||||
pass "shell config lists addable bar widgets"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-config-shell-bar list --json --all | jq -e '
|
||||
any(.[]; .id == "omarchy.tailscale" and .inBar == true and .addable == false) and
|
||||
any(.[]; .id == "omarchy.indicators" and .addable == true)
|
||||
' >/dev/null
|
||||
pass "shell config list --all includes current widget status"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-config-shell-bar position bottom
|
||||
jq -e '
|
||||
.bar.position == "bottom" and
|
||||
@@ -168,6 +180,13 @@ jq -e '
|
||||
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
|
||||
pass "shell config drops widgets from any section"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-config-shell-bar remove local.center
|
||||
jq -e '
|
||||
def ids: map(.id // .);
|
||||
.bar.layout.center | ids == ["omarchy.clock", "omarchy.weather"]
|
||||
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
|
||||
pass "shell config removes widgets with remove alias"
|
||||
|
||||
cat >"$TMPDIR/home/.config/omarchy/shell.json" <<'JSON'
|
||||
{
|
||||
"version": 1,
|
||||
|
||||
@@ -192,3 +192,31 @@ jq -e '
|
||||
}
|
||||
|
||||
pass "runtime geometry places visible update between weather and indicators"
|
||||
|
||||
HOME="$test_home" OMARCHY_PATH="$test_root" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-config-shell-bar" remove omarchy.audio
|
||||
|
||||
for _ in {1..80}; do
|
||||
shell_config=$(shell_ipc shell listShellConfig 2>/dev/null || true)
|
||||
geometry=$(shell_ipc shell debugBarGeometry 2>/dev/null || true)
|
||||
if jq -e 'all(.bar.layout.right[]; (.id // .) != "omarchy.audio")' <<<"$shell_config" >/dev/null 2>&1 && \
|
||||
jq -e 'all(.[]; .id != "omarchy.audio")' <<<"$geometry" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
if ! kill -0 "$QS_PID" 2>/dev/null; then
|
||||
fail_with_log "test shell exited before reloaded bar geometry settled"
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
jq -e 'all(.bar.layout.right[]; (.id // .) != "omarchy.audio")' <<<"$shell_config" >/dev/null || {
|
||||
printf 'Shell config after reload:\n%s\n' "$shell_config" | jq . >&2
|
||||
fail_with_log "config shell bar remove reloads shell config"
|
||||
}
|
||||
|
||||
jq -e 'all(.[]; .id != "omarchy.audio")' <<<"$geometry" >/dev/null || {
|
||||
printf 'Geometry after reload:\n' >&2
|
||||
jq . <<<"$geometry" >&2
|
||||
fail_with_log "runtime bar layout updates after shell config reload"
|
||||
}
|
||||
|
||||
pass "config shell bar remove reloads shell config and updates bar layout"
|
||||
|
||||
Reference in New Issue
Block a user