From a364187fc49c63a35fb34e91e9d804f4e5dfbc46 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Fri, 9 Oct 2026 12:19:13 +0200 Subject: [PATCH] Give plugin enable longer than 2s to reach a reloading shell Adding a plugin sets off two full reloads, one from the rescan and one from the file watcher, and a plugin add --enable discovers the plugin between them, so its one enablePlugin call lands in the second. On a bar with many plugins that rebuild holds the shell past omarchy-shell's 2s default, and the enable reports the shell as not responding and exits 1, though the shell is only busy. Wait up to 10s for this call, unless a timeout is set explicitly. Co-Authored-By: Codex Medium Co-Authored-By: Claude Opus 5.5 --- bin/omarchy-plugin-enable | 4 +++- test/shell.d/plugin-enable-test.sh | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-plugin-enable b/bin/omarchy-plugin-enable index ece1283d82e5..eacabf68393d 100755 --- a/bin/omarchy-plugin-enable +++ b/bin/omarchy-plugin-enable @@ -82,7 +82,9 @@ placement=$(jq -cn \ + (if $after == "" then {} else {after: $after} end) ') -result=$(omarchy-shell shell enablePlugin "$id" "$placement") +# Enabling usually follows a plugin add or change, and the reload that sets off +# can hold the shell past omarchy-shell's 2s default. +result=$(OMARCHY_SHELL_IPC_TIMEOUT=${OMARCHY_SHELL_IPC_TIMEOUT:-10s} omarchy-shell shell enablePlugin "$id" "$placement") if [[ $result == "unknown" ]]; then fail "plugin '$id' is not known; run: omarchy-shell shell rescanPlugins" elif [[ $result != "ok" ]]; then diff --git a/test/shell.d/plugin-enable-test.sh b/test/shell.d/plugin-enable-test.sh index 48872522e63f..17799f8b4e70 100644 --- a/test/shell.d/plugin-enable-test.sh +++ b/test/shell.d/plugin-enable-test.sh @@ -12,6 +12,7 @@ calls="$TMPDIR/calls" cat >"$TMPDIR/bin/omarchy-shell" <<'SH' #!/bin/bash printf '%s\n' "$*" >>"$OMARCHY_TEST_CALLS" +printf '%s\n' "${OMARCHY_SHELL_IPC_TIMEOUT:-}" >>"$OMARCHY_TEST_CALLS.timeout" printf 'ok\n' SH chmod +x "$TMPDIR/bin/omarchy-shell" @@ -20,6 +21,7 @@ run_enable() { HOME="$TMPDIR/home" \ OMARCHY_PATH="$ROOT" \ OMARCHY_TEST_CALLS="$calls" \ + OMARCHY_SHELL_IPC_TIMEOUT="${IPC_TIMEOUT:-}" \ PATH="$TMPDIR/bin:$ROOT/bin:$PATH" \ omarchy-plugin-enable "$@" } @@ -39,6 +41,13 @@ grep -Fqx 'shell enablePlugin omarchy.dropbox {}' "$calls" || fail "plugin enable did not use manifest-default placement" pass "plugin enable leaves default placement to the registry" +[[ $(tail -n1 "$calls.timeout") == "10s" ]] || + fail "plugin enable gave the shell only the default IPC timeout" +IPC_TIMEOUT=3s run_enable omarchy.dropbox >/dev/null +[[ $(tail -n1 "$calls.timeout") == "3s" ]] || + fail "plugin enable overrode an explicit IPC timeout" +pass "plugin enable gives the shell 10s unless told otherwise" + if run_enable omarchy.bar --section right >/dev/null 2>&1; then fail "plugin enable accepted placement for a full bar" fi