Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/omarchy-plugin-enable
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions test/shell.d/plugin-enable-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 "$@"
}
Expand All @@ -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
Expand Down