From a0e2501e15ad72ed0edbc3a7ffc040ffecb24cd5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 1 Aug 2026 18:49:28 -0700 Subject: [PATCH 01/10] Add configurable default coding agent --- bin/omarchy-default-agent | 49 +++++++ bin/omarchy-launch-agent | 54 +++++++ default/omarchy/omarchy-menu.jsonc | 9 ++ install/user/mise.sh | 1 + migrations/1785633225.sh | 3 + test/shell.d/default-agent-test.sh | 219 +++++++++++++++++++++++++++++ test/shell.d/menu-test.sh | 10 ++ 7 files changed, 345 insertions(+) create mode 100755 bin/omarchy-default-agent create mode 100755 bin/omarchy-launch-agent create mode 100644 migrations/1785633225.sh create mode 100644 test/shell.d/default-agent-test.sh diff --git a/bin/omarchy-default-agent b/bin/omarchy-default-agent new file mode 100755 index 00000000..7a4e8a27 --- /dev/null +++ b/bin/omarchy-default-agent @@ -0,0 +1,49 @@ +#!/bin/bash + +# omarchy:summary=Set the default coding agent used by omarchy-launch-agent +# omarchy:args=[pi|omp|opencode|claude|codex|grok|gemini|copilot] +# omarchy:examples=omarchy default agent | omarchy default agent codex | omarchy default agent claude + +agent_file="$HOME/.local/state/omarchy/defaults/agent" + +if (($# == 0)); then + if [[ -f $agent_file ]]; then + read -r agent <"$agent_file" + fi + + [[ -n $agent ]] && echo "$agent" || echo "opencode" + exit 0 +fi + +case "$1" in +pi) agent="pi"; name="Pi" ;; +omp | oh-my-pi) agent="omp"; name="Oh My Pi"; agent_package="oh-my-pi" ;; +opencode | open-code) agent="opencode"; name="OpenCode" ;; +claude | claude-code) agent="claude"; name="Claude Code" ;; +codex) agent="codex"; name="Codex" ;; +grok) agent="grok"; name="Grok"; agent_package="npm:@xai-official/grok" ;; +gemini | gemini-cli) agent="gemini"; name="Gemini" ;; +copilot | github-copilot) agent="copilot"; name="GitHub Copilot" ;; +*) + echo "Usage: omarchy-default-agent " + exit 1 + ;; +esac + +agent_package=${agent_package:-$agent} +installing=false + +if ! mise where "$agent_package" &>/dev/null; then + installing=true + omarchy-notification-send -g 󰚩 "Installing $name with mise" "This might take a few minutes..." +fi + +if ! mise use -g "$agent_package"; then + [[ $installing == "true" ]] && omarchy-notification-send -g 󰚩 "Could not install $name with mise" + exit 1 +fi + +mkdir -p "$(dirname "$agent_file")" +printf '%s\n' "$agent" >"$agent_file" + +omarchy-notification-send -g 󰚩 "$name is now the default coding agent" diff --git a/bin/omarchy-launch-agent b/bin/omarchy-launch-agent new file mode 100755 index 00000000..54950bf6 --- /dev/null +++ b/bin/omarchy-launch-agent @@ -0,0 +1,54 @@ +#!/bin/bash + +# omarchy:summary=Launch the default coding agent in a terminal +# omarchy:args=[prompt...] +# omarchy:examples=omarchy launch agent | omarchy launch agent "Review this project" + +agent=$(omarchy-default-agent) + +if omarchy-cmd-missing "$agent"; then + if [[ -x $HOME/.local/bin/$agent ]]; then + export PATH="$HOME/.local/bin:$PATH" + else + echo "$agent is not installed. Choose an installed agent with: omarchy default agent " >&2 + exit 1 + fi +fi + +if (($# > 0)); then + prompt="$*" +fi + +case "$agent" in +opencode) + if [[ -n ${prompt:-} ]]; then + command=(opencode --prompt "$prompt") + else + command=(opencode) + fi + ;; +gemini) + if [[ -n ${prompt:-} ]]; then + command=(gemini --prompt-interactive "$prompt") + else + command=(gemini) + fi + ;; +copilot) + if [[ -n ${prompt:-} ]]; then + command=(copilot --interactive "$prompt") + else + command=(copilot) + fi + ;; +pi | omp | claude | codex | grok) + command=("$agent") + [[ -n ${prompt:-} ]] && command+=(-- "$prompt") + ;; +*) + echo "Unsupported default agent: $agent" >&2 + exit 1 + ;; +esac + +exec omarchy-launch-tui "${command[@]}" diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index c3382e8b..0c5d424c 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -123,6 +123,15 @@ "setup.input": {"icon":"","label":"Input","when":"[[ -f ~/.config/hypr/input.lua ]]","action":"omarchy-launch-config-editor \"$HOME/.config/hypr/input.lua\""}, "setup.direct-boot": {"icon":"","label":"Direct Boot","action":"omarchy-launch-floating-terminal-with-presentation omarchy-setup-direct-boot"}, "setup.default": {"icon":"","label":"Defaults","aliases":["default","defaults"]}, + "setup.default.agent": {"icon":"󰚩","label":"Agent"}, + "setup.default.agent.pi": {"icon":"󰚩","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, + "setup.default.agent.omp": {"icon":"󰚩","label":"Oh My Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"omp\" ]]","action":"omarchy-default-agent omp"}, + "setup.default.agent.opencode": {"icon":"󰚩","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, + "setup.default.agent.claude": {"icon":"󰚩","label":"Claude Code","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"}, + "setup.default.agent.codex": {"icon":"󰚩","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"}, + "setup.default.agent.grok": {"icon":"󰚩","label":"Grok","checked":"[[ \"$(omarchy-default-agent)\" == \"grok\" ]]","action":"omarchy-default-agent grok"}, + "setup.default.agent.gemini": {"icon":"󰚩","label":"Gemini","checked":"[[ \"$(omarchy-default-agent)\" == \"gemini\" ]]","action":"omarchy-default-agent gemini"}, + "setup.default.agent.copilot": {"icon":"󰚩","label":"GitHub Copilot","checked":"[[ \"$(omarchy-default-agent)\" == \"copilot\" ]]","action":"omarchy-default-agent copilot"}, "setup.default.browser": {"icon":"","label":"Browser"}, "setup.default.browser.chromium": {"icon":"","label":"Chromium","when":"omarchy-cmd-present chromium","checked":"[[ \"$(omarchy-default-browser)\" == \"chromium\" ]]","action":"omarchy-default-browser chromium"}, "setup.default.browser.chrome": {"icon":"󰊯","label":"Chrome","when":"omarchy-cmd-present google-chrome-stable","checked":"[[ \"$(omarchy-default-browser)\" == \"chrome\" ]]","action":"omarchy-default-browser chrome"}, diff --git a/install/user/mise.sh b/install/user/mise.sh index 87c16ac1..e5467395 100644 --- a/install/user/mise.sh +++ b/install/user/mise.sh @@ -7,5 +7,6 @@ omarchy-mise-install opencode omarchy-mise-install npm:playwright playwright omarchy-mise-install pi omarchy-mise-install oh-my-pi omp +omarchy-mise-install npm:@xai-official/grok grok omarchy-mise-install npm:@kitlangton/ghui ghui omarchy-mise-install aqua:modem-dev/hunk hunk diff --git a/migrations/1785633225.sh b/migrations/1785633225.sh new file mode 100644 index 00000000..657ba855 --- /dev/null +++ b/migrations/1785633225.sh @@ -0,0 +1,3 @@ +echo "Install Grok via mise wrapper" + +omarchy-mise-install npm:@xai-official/grok grok diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh new file mode 100644 index 00000000..91da13a8 --- /dev/null +++ b/test/shell.d/default-agent-test.sh @@ -0,0 +1,219 @@ +#!/bin/bash + +set -euo pipefail + +source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" + +test_tmp=$(mktemp -d) +trap 'rm -rf "$test_tmp"' EXIT + +mock_bin="$test_tmp/bin" +test_home="$test_tmp/home" +notification_log="$test_tmp/notifications" +notification_history="$test_tmp/notification-history" +launch_log="$test_tmp/launch" +mise_log="$test_tmp/mise" +mise_history="$test_tmp/mise-history" +stub_log="$test_tmp/stubs" +mkdir -p "$mock_bin" "$test_home" + +cat >"$mock_bin/omarchy-notification-send" <<'SH' +#!/bin/bash +printf '%s\0' "$@" >"$OMARCHY_TEST_NOTIFICATION_LOG" +printf '%s\0' "$@" >>"$OMARCHY_TEST_NOTIFICATION_HISTORY" +SH + +cat >"$mock_bin/omarchy-cmd-missing" <<'SH' +#!/bin/bash +[[ $1 == ${OMARCHY_TEST_MISSING_COMMAND:-} ]] +SH + +cat >"$mock_bin/omarchy-launch-tui" <<'SH' +#!/bin/bash +printf '%s\0' "$@" >"$OMARCHY_TEST_AGENT_LAUNCH_LOG" +SH + +cat >"$mock_bin/omarchy-mise-install" <<'SH' +#!/bin/bash +printf '%s\n' "$*" >>"$OMARCHY_TEST_STUB_LOG" +SH + +cat >"$mock_bin/mise" <<'SH' +#!/bin/bash +printf '%s\0' "$@" >"$OMARCHY_TEST_MISE_LOG" +printf '%s\n' "$*" >>"$OMARCHY_TEST_MISE_HISTORY" + +if [[ $1 == "where" ]]; then + [[ ${OMARCHY_TEST_AGENT_INSTALLED:-false} == "true" ]] + exit +fi + +[[ ${OMARCHY_TEST_MISE_FAIL:-false} != "true" ]] +SH + +chmod +x "$mock_bin"/* + +export HOME="$test_home" +export PATH="$mock_bin:$ROOT/bin:$PATH" +export OMARCHY_TEST_NOTIFICATION_LOG="$notification_log" +export OMARCHY_TEST_NOTIFICATION_HISTORY="$notification_history" +export OMARCHY_TEST_AGENT_LAUNCH_LOG="$launch_log" +export OMARCHY_TEST_MISE_LOG="$mise_log" +export OMARCHY_TEST_MISE_HISTORY="$mise_history" +export OMARCHY_TEST_STUB_LOG="$stub_log" + +grok_package="npm:@xai-official/grok" +omp_package="oh-my-pi" + +assert_lazy_stub() { + local package=$1 + local command=$2 + + : >"$mise_history" + "$ROOT/bin/omarchy-mise-install" "$package" "$command" + "$test_home/.local/bin/$command" --version + mapfile -t mise_calls <"$mise_history" + + [[ ${mise_calls[0]} == "use -g $package" && ${mise_calls[1]} == "x $package -- $command --version" ]] || + fail "$command lazy stub preserves its mise package" +} + +assert_lazy_stub "$grok_package" grok +assert_lazy_stub "$omp_package" omp +pass "custom agent lazy stubs preserve their mise packages" + +source "$ROOT/install/user/mise.sh" +grep -Fx "$grok_package grok" "$stub_log" >/dev/null || fail "user setup creates the Grok lazy stub" +grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "user setup creates the Oh My Pi lazy stub" +pass "user setup creates the custom agent lazy stubs" + +[[ $(omarchy-default-agent) == "opencode" ]] || fail "default agent falls back to OpenCode" +pass "default agent falls back to OpenCode" + +declare -A expected_agents=( + [pi]="pi" + [omp]="omp" + [oh-my-pi]="omp" + [opencode]="opencode" + [open-code]="opencode" + [claude]="claude" + [claude-code]="claude" + [codex]="codex" + [grok]="grok" + [gemini]="gemini" + [gemini-cli]="gemini" + [copilot]="copilot" + [github-copilot]="copilot" +) + +declare -A expected_packages=( + [pi]="pi" + [omp]="$omp_package" + [opencode]="opencode" + [claude]="claude" + [codex]="codex" + [grok]="$grok_package" + [gemini]="gemini" + [copilot]="copilot" +) + +for selection in "${!expected_agents[@]}"; do + expected=${expected_agents[$selection]} + omarchy-default-agent "$selection" + [[ $(omarchy-default-agent) == $expected ]] || fail "default agent canonicalizes $selection" + + mapfile -d '' -t mise_args <"$mise_log" + [[ ${mise_args[0]} == "use" && ${mise_args[1]} == "-g" && ${mise_args[2]} == ${expected_packages[$expected]} ]] || + fail "default agent installs $selection globally through mise" +done +pass "default agent installs and accepts every supported provider and alias" + +: >"$notification_history" +omarchy-default-agent github-copilot +mapfile -d '' -t notification_args <"$notification_log" +[[ ${notification_args[0]} == "-g" && ${notification_args[2]} == "GitHub Copilot is now the default coding agent" ]] || + fail "default agent sends a selection notification" +mapfile -d '' -t notification_history_args <"$notification_history" +[[ ${notification_history_args[2]} == "Installing GitHub Copilot with mise" && ${notification_history_args[3]} == "This might take a few minutes..." ]] || + fail "default agent describes how long installation might take" +pass "default agent sends installation and selection notifications" + +: >"$notification_history" +OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent github-copilot +mapfile -d '' -t notification_history_args <"$notification_history" +[[ ${#notification_history_args[@]} == 3 && ${notification_history_args[2]} == "GitHub Copilot is now the default coding agent" ]] || + fail "default agent skips installation notifications when the provider is already installed" +mapfile -d '' -t mise_args <"$mise_log" +[[ ${mise_args[0]} == "use" && ${mise_args[1]} == "-g" && ${mise_args[2]} == "copilot" ]] || + fail "default agent still activates an installed provider globally through mise" +pass "default agent only sends installation notifications for missing providers" + +if omarchy-default-agent unsupported >"$test_tmp/invalid-output" 2>&1; then + fail "default agent rejects unsupported providers" +fi +grep -F "Usage: omarchy-default-agent" "$test_tmp/invalid-output" >/dev/null || + fail "default agent explains supported providers" +[[ $(omarchy-default-agent) == "copilot" ]] || fail "invalid selection preserves the current default agent" +pass "default agent rejects unsupported providers without changing the selection" + +if OMARCHY_TEST_MISE_FAIL=true omarchy-default-agent codex >"$test_tmp/install-failure-output" 2>&1; then + fail "default agent rejects a failed mise installation" +fi +[[ $(omarchy-default-agent) == "copilot" ]] || fail "failed installation preserves the current default agent" +mapfile -d '' -t notification_args <"$notification_log" +[[ ${notification_args[2]} == "Could not install Codex with mise" ]] || + fail "default agent reports a failed mise installation" +pass "default agent changes selection only after mise installs the provider" + +assert_launch() { + local agent=$1 + shift + local expected=("$@") + + printf '%s\n' "$agent" >"$test_home/.local/state/omarchy/defaults/agent" + omarchy-launch-agent "Review this" project + mapfile -d '' -t actual <"$launch_log" + + (( ${#actual[@]} == ${#expected[@]} )) || + fail "$agent launch has the expected argument count" "expected: ${expected[*]}\nactual: ${actual[*]}" + + for ((index = 0; index < ${#expected[@]}; index++)); do + [[ ${actual[$index]} == ${expected[$index]} ]] || + fail "$agent launch forwards the interactive prompt" "expected: ${expected[*]}\nactual: ${actual[*]}" + done +} + +assert_launch pi pi -- "Review this project" +assert_launch omp omp -- "Review this project" +assert_launch opencode opencode --prompt "Review this project" +assert_launch claude claude -- "Review this project" +assert_launch codex codex -- "Review this project" +assert_launch grok grok -- "Review this project" +assert_launch gemini gemini --prompt-interactive "Review this project" +assert_launch copilot copilot --interactive "Review this project" +pass "agent launcher adapts initial prompts for every supported agent" + +mkdir -p "$test_home/.local/bin" +touch "$test_home/.local/bin/gemini" +chmod +x "$test_home/.local/bin/gemini" +printf '%s\n' "gemini" >"$test_home/.local/state/omarchy/defaults/agent" +OMARCHY_TEST_MISSING_COMMAND=gemini omarchy-launch-agent "Review this project" +mapfile -d '' -t launch_args <"$launch_log" +[[ ${launch_args[0]} == "gemini" && ${launch_args[1]} == "--prompt-interactive" ]] || + fail "agent launcher finds a lazy wrapper outside the session PATH" +pass "agent launcher finds lazy wrappers outside the session PATH" + +printf '%s\n' "opencode" >"$test_home/.local/state/omarchy/defaults/agent" +omarchy-launch-agent +mapfile -d '' -t launch_args <"$launch_log" +[[ ${#launch_args[@]} == 1 && ${launch_args[0]} == "opencode" ]] || + fail "agent launcher starts the selected agent without an initial prompt" +pass "agent launcher starts the selected agent without an initial prompt" + +printf '%s\n' "missing" >"$test_home/.local/state/omarchy/defaults/agent" +if OMARCHY_TEST_MISSING_COMMAND=missing omarchy-launch-agent >"$test_tmp/missing-output" 2>&1; then + fail "agent launcher rejects a missing default command" +fi +grep -F "missing is not installed" "$test_tmp/missing-output" >/dev/null || + fail "agent launcher explains when the default command is missing" +pass "agent launcher reports a missing default command" diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index 6ff4f015..4a5b0864 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -167,6 +167,16 @@ assertEqual( defaultItems.findIndex(item => item.id === 'setup.input') + 1, 'menu lists Direct Boot immediately below Input' ) +assert( + ['pi', 'omp', 'opencode', 'claude', 'codex', 'grok', 'gemini', 'copilot'].every(agent => { + const entry = defaultById[`setup.default.agent.${agent}`] + return entry + && entry.action === `omarchy-default-agent ${agent}` + && !entry.when + && entry.checked.includes(`== \"${agent}\"`) + }), + 'menu exposes every mise-installable coding agent under Defaults > Agent' +) assert( defaultById['setup.security.passwordless-sudo'].action.includes('omarchy-sudo-passwordless'), 'menu places Passwordless Sudo under Setup > Security' From a9b84cea8ef10766f3dac4741dbccb54e6875f9a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 1 Aug 2026 19:11:44 -0700 Subject: [PATCH 02/10] Refine default agent menu --- bin/omarchy-default-agent | 5 +++-- bin/omarchy-launch-agent | 7 +++++++ default/omarchy/omarchy-menu.jsonc | 18 +++++++++--------- install/user/mise.sh | 1 + migrations/1785633225.sh | 3 ++- test/shell.d/default-agent-test.sh | 6 ++++++ test/shell.d/menu-test.sh | 18 ++++++++++++++++-- 7 files changed, 44 insertions(+), 14 deletions(-) diff --git a/bin/omarchy-default-agent b/bin/omarchy-default-agent index 7a4e8a27..cd6582c6 100755 --- a/bin/omarchy-default-agent +++ b/bin/omarchy-default-agent @@ -1,7 +1,7 @@ #!/bin/bash # omarchy:summary=Set the default coding agent used by omarchy-launch-agent -# omarchy:args=[pi|omp|opencode|claude|codex|grok|gemini|copilot] +# omarchy:args=[pi|omp|opencode|claude|codex|grok|gemini|copilot|crush] # omarchy:examples=omarchy default agent | omarchy default agent codex | omarchy default agent claude agent_file="$HOME/.local/state/omarchy/defaults/agent" @@ -21,11 +21,12 @@ omp | oh-my-pi) agent="omp"; name="Oh My Pi"; agent_package="oh-my-pi" ;; opencode | open-code) agent="opencode"; name="OpenCode" ;; claude | claude-code) agent="claude"; name="Claude Code" ;; codex) agent="codex"; name="Codex" ;; +crush) agent="crush"; name="Crush" ;; grok) agent="grok"; name="Grok"; agent_package="npm:@xai-official/grok" ;; gemini | gemini-cli) agent="gemini"; name="Gemini" ;; copilot | github-copilot) agent="copilot"; name="GitHub Copilot" ;; *) - echo "Usage: omarchy-default-agent " + echo "Usage: omarchy-default-agent " exit 1 ;; esac diff --git a/bin/omarchy-launch-agent b/bin/omarchy-launch-agent index 54950bf6..aef81821 100755 --- a/bin/omarchy-launch-agent +++ b/bin/omarchy-launch-agent @@ -41,6 +41,13 @@ copilot) command=(copilot) fi ;; +crush) + if [[ -n ${prompt:-} ]]; then + command=(crush run "$prompt") + else + command=(crush) + fi + ;; pi | omp | claude | codex | grok) command=("$agent") [[ -n ${prompt:-} ]] && command+=(-- "$prompt") diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index 0c5d424c..cf901d2e 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -124,14 +124,15 @@ "setup.direct-boot": {"icon":"","label":"Direct Boot","action":"omarchy-launch-floating-terminal-with-presentation omarchy-setup-direct-boot"}, "setup.default": {"icon":"","label":"Defaults","aliases":["default","defaults"]}, "setup.default.agent": {"icon":"󰚩","label":"Agent"}, - "setup.default.agent.pi": {"icon":"󰚩","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, - "setup.default.agent.omp": {"icon":"󰚩","label":"Oh My Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"omp\" ]]","action":"omarchy-default-agent omp"}, - "setup.default.agent.opencode": {"icon":"󰚩","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, - "setup.default.agent.claude": {"icon":"󰚩","label":"Claude Code","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"}, - "setup.default.agent.codex": {"icon":"󰚩","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"}, - "setup.default.agent.grok": {"icon":"󰚩","label":"Grok","checked":"[[ \"$(omarchy-default-agent)\" == \"grok\" ]]","action":"omarchy-default-agent grok"}, - "setup.default.agent.gemini": {"icon":"󰚩","label":"Gemini","checked":"[[ \"$(omarchy-default-agent)\" == \"gemini\" ]]","action":"omarchy-default-agent gemini"}, - "setup.default.agent.copilot": {"icon":"󰚩","label":"GitHub Copilot","checked":"[[ \"$(omarchy-default-agent)\" == \"copilot\" ]]","action":"omarchy-default-agent copilot"}, + "setup.default.agent.pi": {"icon":"󰏿","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, + "setup.default.agent.omp": {"icon":"󰣪","label":"omp","checked":"[[ \"$(omarchy-default-agent)\" == \"omp\" ]]","action":"omarchy-default-agent omp"}, + "setup.default.agent.opencode": {"icon":"󰕪","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, + "setup.default.agent.claude": {"icon":"󰛄","label":"Claude","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"}, + "setup.default.agent.codex": {"icon":"󰞵","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"}, + "setup.default.agent.grok": {"icon":"󰰱","label":"Grok","checked":"[[ \"$(omarchy-default-agent)\" == \"grok\" ]]","action":"omarchy-default-agent grok"}, + "setup.default.agent.gemini": {"icon":"󰫢","label":"Gemini","checked":"[[ \"$(omarchy-default-agent)\" == \"gemini\" ]]","action":"omarchy-default-agent gemini"}, + "setup.default.agent.copilot": {"icon":"","label":"Copilot","checked":"[[ \"$(omarchy-default-agent)\" == \"copilot\" ]]","action":"omarchy-default-agent copilot"}, + "setup.default.agent.crush": {"icon":"󰋑","label":"Crush","checked":"[[ \"$(omarchy-default-agent)\" == \"crush\" ]]","action":"omarchy-default-agent crush"}, "setup.default.browser": {"icon":"","label":"Browser"}, "setup.default.browser.chromium": {"icon":"","label":"Chromium","when":"omarchy-cmd-present chromium","checked":"[[ \"$(omarchy-default-browser)\" == \"chromium\" ]]","action":"omarchy-default-browser chromium"}, "setup.default.browser.chrome": {"icon":"󰊯","label":"Chrome","when":"omarchy-cmd-present google-chrome-stable","checked":"[[ \"$(omarchy-default-browser)\" == \"chrome\" ]]","action":"omarchy-default-browser chrome"}, @@ -215,7 +216,6 @@ "install.ai.dictation": {"icon":"","label":"Dictation","when":"! omarchy-pkg-present voxtype-bin","action":"omarchy-launch-floating-terminal-with-presentation omarchy-voxtype-install"}, "install.ai.lm-studio": {"icon":"󱚤","label":"LM Studio","when":"! omarchy-pkg-present lmstudio-bin","action":"omarchy-install-app 'LM Studio' lmstudio-bin"}, "install.ai.ollama": {"icon":"󱚤","label":"Ollama","when":"! omarchy-cmd-present ollama","action":"if omarchy-cmd-present nvidia-smi; then ollama_pkg=ollama-cuda; elif omarchy-cmd-present rocminfo; then ollama_pkg=ollama-rocm; else ollama_pkg=ollama; fi; omarchy-install-app Ollama \"$ollama_pkg\""}, - "install.ai.crush": {"icon":"󱚤","label":"Crush","when":"! omarchy-pkg-present crush-bin","action":"omarchy-install-app Crush crush-bin"}, "install.gaming.steam": {"icon":"","label":"Steam","when":"! omarchy-pkg-present steam","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-gaming-steam"}, "install.gaming.retroarch": {"icon":"󰯉","label":"RetroArch","when":"! omarchy-pkg-present retroarch","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-gaming-retroarch"}, "install.gaming.minecraft": {"icon":"󰍳","label":"Minecraft","when":"! omarchy-pkg-present minecraft-launcher","action":"omarchy-install-and-launch Minecraft minecraft-launcher minecraft-launcher"}, diff --git a/install/user/mise.sh b/install/user/mise.sh index e5467395..d863e564 100644 --- a/install/user/mise.sh +++ b/install/user/mise.sh @@ -1,5 +1,6 @@ omarchy-mise-install codex omarchy-mise-install claude +omarchy-mise-install crush omarchy-mise-install gemini omarchy-mise-install gh omarchy-mise-install copilot diff --git a/migrations/1785633225.sh b/migrations/1785633225.sh index 657ba855..70c6e9f5 100644 --- a/migrations/1785633225.sh +++ b/migrations/1785633225.sh @@ -1,3 +1,4 @@ -echo "Install Grok via mise wrapper" +echo "Install Grok and Crush via mise wrappers" omarchy-mise-install npm:@xai-official/grok grok +omarchy-mise-install crush diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index 91da13a8..dcdd0014 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -64,6 +64,7 @@ export OMARCHY_TEST_STUB_LOG="$stub_log" grok_package="npm:@xai-official/grok" omp_package="oh-my-pi" +crush_package="crush" assert_lazy_stub() { local package=$1 @@ -80,11 +81,13 @@ assert_lazy_stub() { assert_lazy_stub "$grok_package" grok assert_lazy_stub "$omp_package" omp +assert_lazy_stub "$crush_package" crush pass "custom agent lazy stubs preserve their mise packages" source "$ROOT/install/user/mise.sh" grep -Fx "$grok_package grok" "$stub_log" >/dev/null || fail "user setup creates the Grok lazy stub" grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "user setup creates the Oh My Pi lazy stub" +grep -Fx "$crush_package" "$stub_log" >/dev/null || fail "user setup creates the Crush lazy stub" pass "user setup creates the custom agent lazy stubs" [[ $(omarchy-default-agent) == "opencode" ]] || fail "default agent falls back to OpenCode" @@ -99,6 +102,7 @@ declare -A expected_agents=( [claude]="claude" [claude-code]="claude" [codex]="codex" + [crush]="crush" [grok]="grok" [gemini]="gemini" [gemini-cli]="gemini" @@ -112,6 +116,7 @@ declare -A expected_packages=( [opencode]="opencode" [claude]="claude" [codex]="codex" + [crush]="$crush_package" [grok]="$grok_package" [gemini]="gemini" [copilot]="copilot" @@ -188,6 +193,7 @@ assert_launch omp omp -- "Review this project" assert_launch opencode opencode --prompt "Review this project" assert_launch claude claude -- "Review this project" assert_launch codex codex -- "Review this project" +assert_launch crush crush run "Review this project" assert_launch grok grok -- "Review this project" assert_launch gemini gemini --prompt-interactive "Review this project" assert_launch copilot copilot --interactive "Review this project" diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index 4a5b0864..5ed5db98 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -167,16 +167,30 @@ assertEqual( defaultItems.findIndex(item => item.id === 'setup.input') + 1, 'menu lists Direct Boot immediately below Input' ) +const expectedAgents = { + pi: { icon: '󰏿', label: 'Pi' }, + omp: { icon: '󰣪', label: 'omp' }, + opencode: { icon: '󰕪', label: 'OpenCode' }, + claude: { icon: '󰛄', label: 'Claude' }, + codex: { icon: '󰞵', label: 'Codex' }, + grok: { icon: '󰰱', label: 'Grok' }, + gemini: { icon: '󰫢', label: 'Gemini' }, + copilot: { icon: '', label: 'Copilot' }, + crush: { icon: '󰋑', label: 'Crush' }, +} assert( - ['pi', 'omp', 'opencode', 'claude', 'codex', 'grok', 'gemini', 'copilot'].every(agent => { + Object.entries(expectedAgents).every(([agent, expected]) => { const entry = defaultById[`setup.default.agent.${agent}`] return entry + && entry.icon === expected.icon + && entry.label === expected.label && entry.action === `omarchy-default-agent ${agent}` && !entry.when && entry.checked.includes(`== \"${agent}\"`) }), - 'menu exposes every mise-installable coding agent under Defaults > Agent' + 'menu exposes every mise-installable coding agent with its own glyph under Defaults > Agent' ) +assert(!defaultById['install.ai.crush'], 'menu removes Crush from Install > AI') assert( defaultById['setup.security.passwordless-sudo'].action.includes('omarchy-sudo-passwordless'), 'menu places Passwordless Sudo under Setup > Security' From 6009e8a73ba5eb696b2553dc2dbe6b0010fb8caa Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 1 Aug 2026 19:16:11 -0700 Subject: [PATCH 03/10] Sort default agents alphabetically --- default/omarchy/omarchy-menu.jsonc | 10 +++++----- test/shell.d/menu-test.sh | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index cf901d2e..00217fff 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -124,15 +124,15 @@ "setup.direct-boot": {"icon":"","label":"Direct Boot","action":"omarchy-launch-floating-terminal-with-presentation omarchy-setup-direct-boot"}, "setup.default": {"icon":"","label":"Defaults","aliases":["default","defaults"]}, "setup.default.agent": {"icon":"󰚩","label":"Agent"}, - "setup.default.agent.pi": {"icon":"󰏿","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, - "setup.default.agent.omp": {"icon":"󰣪","label":"omp","checked":"[[ \"$(omarchy-default-agent)\" == \"omp\" ]]","action":"omarchy-default-agent omp"}, - "setup.default.agent.opencode": {"icon":"󰕪","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, "setup.default.agent.claude": {"icon":"󰛄","label":"Claude","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"}, "setup.default.agent.codex": {"icon":"󰞵","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"}, - "setup.default.agent.grok": {"icon":"󰰱","label":"Grok","checked":"[[ \"$(omarchy-default-agent)\" == \"grok\" ]]","action":"omarchy-default-agent grok"}, - "setup.default.agent.gemini": {"icon":"󰫢","label":"Gemini","checked":"[[ \"$(omarchy-default-agent)\" == \"gemini\" ]]","action":"omarchy-default-agent gemini"}, "setup.default.agent.copilot": {"icon":"","label":"Copilot","checked":"[[ \"$(omarchy-default-agent)\" == \"copilot\" ]]","action":"omarchy-default-agent copilot"}, "setup.default.agent.crush": {"icon":"󰋑","label":"Crush","checked":"[[ \"$(omarchy-default-agent)\" == \"crush\" ]]","action":"omarchy-default-agent crush"}, + "setup.default.agent.gemini": {"icon":"󰫢","label":"Gemini","checked":"[[ \"$(omarchy-default-agent)\" == \"gemini\" ]]","action":"omarchy-default-agent gemini"}, + "setup.default.agent.grok": {"icon":"󰰱","label":"Grok","checked":"[[ \"$(omarchy-default-agent)\" == \"grok\" ]]","action":"omarchy-default-agent grok"}, + "setup.default.agent.omp": {"icon":"󰣪","label":"omp","checked":"[[ \"$(omarchy-default-agent)\" == \"omp\" ]]","action":"omarchy-default-agent omp"}, + "setup.default.agent.opencode": {"icon":"󰕪","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, + "setup.default.agent.pi": {"icon":"󰏿","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, "setup.default.browser": {"icon":"","label":"Browser"}, "setup.default.browser.chromium": {"icon":"","label":"Chromium","when":"omarchy-cmd-present chromium","checked":"[[ \"$(omarchy-default-browser)\" == \"chromium\" ]]","action":"omarchy-default-browser chromium"}, "setup.default.browser.chrome": {"icon":"󰊯","label":"Chrome","when":"omarchy-cmd-present google-chrome-stable","checked":"[[ \"$(omarchy-default-browser)\" == \"chrome\" ]]","action":"omarchy-default-browser chrome"}, diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index 5ed5db98..d7621e18 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -190,6 +190,13 @@ assert( }), 'menu exposes every mise-installable coding agent with its own glyph under Defaults > Agent' ) +assertDeepEqual( + defaultItems + .filter(item => item.parent === 'setup.default.agent') + .map(item => item.label), + ['Claude', 'Codex', 'Copilot', 'Crush', 'Gemini', 'Grok', 'omp', 'OpenCode', 'Pi'], + 'menu sorts coding agents alphabetically' +) assert(!defaultById['install.ai.crush'], 'menu removes Crush from Install > AI') assert( defaultById['setup.security.passwordless-sudo'].action.includes('omarchy-sudo-passwordless'), From 7b4fb0ad6b2c35e15d4b53167190b0954354b79a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 1 Aug 2026 19:52:04 -0700 Subject: [PATCH 04/10] Fix default agent setup edge cases --- bin/omarchy-default-agent | 8 +++-- bin/omarchy-remove-preinstalls | 2 +- install/user/mise.sh | 2 +- migrations/1785617047.sh | 4 ++- migrations/1785633225.sh | 11 +++++-- test/shell.d/default-agent-test.sh | 51 +++++++++++++++++++++++++++++- 6 files changed, 69 insertions(+), 9 deletions(-) diff --git a/bin/omarchy-default-agent b/bin/omarchy-default-agent index cd6582c6..d131ad00 100755 --- a/bin/omarchy-default-agent +++ b/bin/omarchy-default-agent @@ -17,7 +17,7 @@ fi case "$1" in pi) agent="pi"; name="Pi" ;; -omp | oh-my-pi) agent="omp"; name="Oh My Pi"; agent_package="oh-my-pi" ;; +omp | oh-my-pi) agent="omp"; name="Oh My Pi"; agent_package="github:can1357/oh-my-pi" ;; opencode | open-code) agent="opencode"; name="OpenCode" ;; claude | claude-code) agent="claude"; name="Claude Code" ;; codex) agent="codex"; name="Codex" ;; @@ -40,7 +40,11 @@ if ! mise where "$agent_package" &>/dev/null; then fi if ! mise use -g "$agent_package"; then - [[ $installing == "true" ]] && omarchy-notification-send -g 󰚩 "Could not install $name with mise" + if [[ $installing == "true" ]]; then + omarchy-notification-send -g 󰚩 "Could not install $name with mise" + else + omarchy-notification-send -g 󰚩 "Could not set $name as the default coding agent" + fi exit 1 fi diff --git a/bin/omarchy-remove-preinstalls b/bin/omarchy-remove-preinstalls index 262b1560..e3c9c908 100755 --- a/bin/omarchy-remove-preinstalls +++ b/bin/omarchy-remove-preinstalls @@ -15,7 +15,7 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w # Remove mise stubs rm -f ~/.local/bin/codex ~/.local/bin/claude ~/.local/bin/gemini ~/.local/bin/copilot \ ~/.local/bin/gh ~/.local/bin/opencode ~/.local/bin/playwright ~/.local/bin/playwright-cli ~/.local/bin/pi \ - ~/.local/bin/ghui ~/.local/bin/hunk + ~/.local/bin/omp ~/.local/bin/grok ~/.local/bin/crush ~/.local/bin/ghui ~/.local/bin/hunk omarchy-pkg-drop \ aether \ diff --git a/install/user/mise.sh b/install/user/mise.sh index d863e564..a800393d 100644 --- a/install/user/mise.sh +++ b/install/user/mise.sh @@ -7,7 +7,7 @@ omarchy-mise-install copilot omarchy-mise-install opencode omarchy-mise-install npm:playwright playwright omarchy-mise-install pi -omarchy-mise-install oh-my-pi omp +omarchy-mise-install github:can1357/oh-my-pi omp omarchy-mise-install npm:@xai-official/grok grok omarchy-mise-install npm:@kitlangton/ghui ghui omarchy-mise-install aqua:modem-dev/hunk hunk diff --git a/migrations/1785617047.sh b/migrations/1785617047.sh index 89054cad..b9dd386d 100644 --- a/migrations/1785617047.sh +++ b/migrations/1785617047.sh @@ -1,3 +1,5 @@ echo "Install oh-my-pi (omp) via mise wrapper" -omarchy-mise-install oh-my-pi omp +if [[ ! -f $HOME/.local/state/omarchy/preinstalls-removed ]]; then + omarchy-mise-install github:can1357/oh-my-pi omp +fi diff --git a/migrations/1785633225.sh b/migrations/1785633225.sh index 70c6e9f5..f3f5aab9 100644 --- a/migrations/1785633225.sh +++ b/migrations/1785633225.sh @@ -1,4 +1,9 @@ -echo "Install Grok and Crush via mise wrappers" +echo "Install default coding agent mise wrappers" -omarchy-mise-install npm:@xai-official/grok grok -omarchy-mise-install crush +if [[ ! -f $HOME/.local/state/omarchy/preinstalls-removed ]]; then + omarchy-mise-install github:can1357/oh-my-pi omp + omarchy-mise-install npm:@xai-official/grok grok + omarchy-mise-install crush +elif [[ -f $HOME/.local/bin/omp ]] && grep -Fq 'mise use -g "oh-my-pi"' "$HOME/.local/bin/omp"; then + rm -f "$HOME/.local/bin/omp" +fi diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index dcdd0014..0886c347 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -51,6 +51,15 @@ fi [[ ${OMARCHY_TEST_MISE_FAIL:-false} != "true" ]] SH +cat >"$mock_bin/omarchy-test-noop" <<'SH' +#!/bin/bash +exit 0 +SH + +for command in gum hyprctl omarchy-webapp-remove-all omarchy-tui-remove-all omarchy-pkg-drop; do + ln -s omarchy-test-noop "$mock_bin/$command" +done + chmod +x "$mock_bin"/* export HOME="$test_home" @@ -63,7 +72,7 @@ export OMARCHY_TEST_MISE_HISTORY="$mise_history" export OMARCHY_TEST_STUB_LOG="$stub_log" grok_package="npm:@xai-official/grok" -omp_package="oh-my-pi" +omp_package="github:can1357/oh-my-pi" crush_package="crush" assert_lazy_stub() { @@ -90,6 +99,33 @@ grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "user setup creates t grep -Fx "$crush_package" "$stub_log" >/dev/null || fail "user setup creates the Crush lazy stub" pass "user setup creates the custom agent lazy stubs" +: >"$stub_log" +source "$ROOT/migrations/1785617047.sh" >/dev/null +grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "Oh My Pi migration creates a working lazy stub" + +: >"$stub_log" +source "$ROOT/migrations/1785633225.sh" >/dev/null +grep -Fx "$omp_package omp" "$stub_log" >/dev/null || fail "agent migration repairs the Oh My Pi lazy stub" +grep -Fx "$grok_package grok" "$stub_log" >/dev/null || fail "agent migration creates the Grok lazy stub" +grep -Fx "$crush_package" "$stub_log" >/dev/null || fail "agent migration creates the Crush lazy stub" + +mkdir -p "$test_home/.local/state/omarchy" +touch "$test_home/.local/state/omarchy/preinstalls-removed" +"$ROOT/bin/omarchy-mise-install" oh-my-pi omp +: >"$stub_log" +source "$ROOT/migrations/1785617047.sh" >/dev/null +source "$ROOT/migrations/1785633225.sh" >/dev/null +[[ ! -s $stub_log ]] || fail "agent migrations respect the preinstall opt-out" +[[ ! -e $test_home/.local/bin/omp ]] || fail "agent migration removes the obsolete Oh My Pi wrapper after opt-out" +rm "$test_home/.local/state/omarchy/preinstalls-removed" +pass "agent migrations install working wrappers without overriding the preinstall opt-out" + +omarchy-remove-preinstalls >/dev/null +for command in omp grok crush; do + [[ ! -e $test_home/.local/bin/$command ]] || fail "Remove Preinstalls deletes the $command lazy stub" +done +pass "Remove Preinstalls deletes every optional agent lazy stub" + [[ $(omarchy-default-agent) == "opencode" ]] || fail "default agent falls back to OpenCode" pass "default agent falls back to OpenCode" @@ -170,6 +206,19 @@ mapfile -d '' -t notification_args <"$notification_log" fail "default agent reports a failed mise installation" pass "default agent changes selection only after mise installs the provider" +: >"$notification_history" +if OMARCHY_TEST_AGENT_INSTALLED=true OMARCHY_TEST_MISE_FAIL=true omarchy-default-agent codex >"$test_tmp/setup-failure-output" 2>&1; then + fail "default agent rejects a failed mise activation" +fi +[[ $(omarchy-default-agent) == "copilot" ]] || fail "failed activation preserves the current default agent" +mapfile -d '' -t notification_args <"$notification_log" +[[ ${notification_args[2]} == "Could not set Codex as the default coding agent" ]] || + fail "default agent reports a failed activation for an installed provider" +mapfile -d '' -t notification_history_args <"$notification_history" +[[ ${#notification_history_args[@]} == 3 ]] || + fail "failed activation sends only the selection failure notification" +pass "default agent reports mise failures for installed providers" + assert_launch() { local agent=$1 shift From 5ea4fb56f4bc30981e93ef1e4f81ec05292566ac Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Aug 2026 05:53:30 -0700 Subject: [PATCH 05/10] Add default agent shortcuts --- bin/omarchy-launch-agent | 21 +++++++++++++++-- default/bash/aliases | 1 + default/hypr/bindings/utilities.lua | 1 + test/shell.d/default-agent-test.sh | 36 +++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) diff --git a/bin/omarchy-launch-agent b/bin/omarchy-launch-agent index aef81821..9e5a5ddc 100755 --- a/bin/omarchy-launch-agent +++ b/bin/omarchy-launch-agent @@ -1,9 +1,22 @@ #!/bin/bash # omarchy:summary=Launch the default coding agent in a terminal -# omarchy:args=[prompt...] +# omarchy:args=[--inline] [prompt...] # omarchy:examples=omarchy launch agent | omarchy launch agent "Review this project" +if [[ ${1:-} == "--inline" ]]; then + inline=true + shift +else + inline=false +fi + +agent_file="$HOME/.local/state/omarchy/defaults/agent" + +if [[ ! -s $agent_file ]]; then + exec omarchy-menu summon setup.default.agent +fi + agent=$(omarchy-default-agent) if omarchy-cmd-missing "$agent"; then @@ -58,4 +71,8 @@ pi | omp | claude | codex | grok) ;; esac -exec omarchy-launch-tui "${command[@]}" +if [[ $inline == "true" ]]; then + exec "${command[@]}" +else + exec omarchy-launch-tui "${command[@]}" +fi diff --git a/default/bash/aliases b/default/bash/aliases index 7433541e..bc44e0bf 100644 --- a/default/bash/aliases +++ b/default/bash/aliases @@ -43,6 +43,7 @@ alias ...='cd ../..' alias ....='cd ../../..' # Tools +alias a='omarchy-launch-agent --inline' alias c='opencode --auto' alias cx='printf "\033[2J\033[3J\033[H" && claude --permission-mode bypassPermissions' alias cy='codex -s danger-full-access -a never' diff --git a/default/hypr/bindings/utilities.lua b/default/hypr/bindings/utilities.lua index 6be42a7a..48b9c519 100644 --- a/default/hypr/bindings/utilities.lua +++ b/default/hypr/bindings/utilities.lua @@ -74,6 +74,7 @@ o.bind("SUPER + CTRL + ALT + T", "Show time", "omarchy-notification-time") o.bind("SUPER + CTRL + ALT + B", "Show battery remaining", "omarchy-notification-battery") o.bind("SUPER + CTRL + ALT + W", "Toggle weather", "omarchy-notification-weather") +o.bind("SUPER + SHIFT + CTRL + A", "Agent", "omarchy-launch-agent") o.bind("SUPER + CTRL + A", "Audio", "omarchy-shell shell toggle omarchy.audio") o.bind("SUPER + CTRL + B", "Bluetooth", "omarchy-shell shell toggle omarchy.bluetooth") o.bind("SUPER + CTRL + D", "Display", "omarchy-shell shell toggle omarchy.monitor") diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index 895bedf4..1c284867 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -12,8 +12,10 @@ test_home="$test_tmp/home" notification_log="$test_tmp/notifications" notification_history="$test_tmp/notification-history" launch_log="$test_tmp/launch" +inline_log="$test_tmp/inline" mise_log="$test_tmp/mise" mise_history="$test_tmp/mise-history" +picker_log="$test_tmp/picker" stub_log="$test_tmp/stubs" mkdir -p "$mock_bin" "$test_home" @@ -33,6 +35,16 @@ cat >"$mock_bin/omarchy-launch-tui" <<'SH' printf '%s\0' "$@" >"$OMARCHY_TEST_AGENT_LAUNCH_LOG" SH +cat >"$mock_bin/omarchy-menu" <<'SH' +#!/bin/bash +printf '%s\0' "$@" >"$OMARCHY_TEST_AGENT_PICKER_LOG" +SH + +cat >"$mock_bin/opencode" <<'SH' +#!/bin/bash +printf '%s\0' opencode "$@" >"$OMARCHY_TEST_AGENT_INLINE_LOG" +SH + cat >"$mock_bin/omarchy-mise-install" <<'SH' #!/bin/bash printf '%s\n' "$*" >>"$OMARCHY_TEST_STUB_LOG" @@ -67,6 +79,8 @@ export PATH="$mock_bin:$ROOT/bin:$PATH" export OMARCHY_TEST_NOTIFICATION_LOG="$notification_log" export OMARCHY_TEST_NOTIFICATION_HISTORY="$notification_history" export OMARCHY_TEST_AGENT_LAUNCH_LOG="$launch_log" +export OMARCHY_TEST_AGENT_INLINE_LOG="$inline_log" +export OMARCHY_TEST_AGENT_PICKER_LOG="$picker_log" export OMARCHY_TEST_MISE_LOG="$mise_log" export OMARCHY_TEST_MISE_HISTORY="$mise_history" export OMARCHY_TEST_STUB_LOG="$stub_log" @@ -129,6 +143,22 @@ pass "Remove Preinstalls deletes every optional agent lazy stub" [[ $(omarchy-default-agent) == "opencode" ]] || fail "default agent falls back to OpenCode" pass "default agent falls back to OpenCode" +omarchy-launch-agent +mapfile -d '' -t picker_args <"$picker_log" +[[ ${picker_args[0]} == "summon" && ${picker_args[1]} == "setup.default.agent" ]] || + fail "agent launcher opens the picker before a default is selected" +pass "agent launcher opens the picker before a default is selected" + +source "$ROOT/default/bash/aliases" +[[ $(alias a) == "alias a='omarchy-launch-agent --inline'" ]] || + fail "terminal alias launches the default agent inline" +pass "terminal alias launches the default agent inline" + +grep -Fq 'o.bind("SUPER + SHIFT + CTRL + A", "Agent", "omarchy-launch-agent")' \ + "$ROOT/default/hypr/bindings/utilities.lua" || + fail "agent launcher has a keyboard shortcut" +pass "agent launcher has a keyboard shortcut" + declare -A expected_agents=( [pi]="pi" [omp]="omp" @@ -265,6 +295,12 @@ mapfile -d '' -t launch_args <"$launch_log" fail "agent launcher starts the selected agent without an initial prompt" pass "agent launcher starts the selected agent without an initial prompt" +omarchy-launch-agent --inline "Review this project" +mapfile -d '' -t inline_args <"$inline_log" +[[ ${inline_args[0]} == "opencode" && ${inline_args[1]} == "--prompt" && ${inline_args[2]} == "Review this project" ]] || + fail "inline agent launcher runs in the current terminal" +pass "inline agent launcher runs in the current terminal" + printf '%s\n' "missing" >"$test_home/.local/state/omarchy/defaults/agent" if OMARCHY_TEST_MISSING_COMMAND=missing omarchy-launch-agent >"$test_tmp/missing-output" 2>&1; then fail "agent launcher rejects a missing default command" From 2324851da1bfd53b3cfd449a225cf0a412c278a7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Aug 2026 06:06:04 -0700 Subject: [PATCH 06/10] Fall back to OpenCode in agent launcher --- bin/omarchy-launch-agent | 6 ------ test/shell.d/default-agent-test.sh | 15 ++++----------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/bin/omarchy-launch-agent b/bin/omarchy-launch-agent index 9e5a5ddc..0c619b09 100755 --- a/bin/omarchy-launch-agent +++ b/bin/omarchy-launch-agent @@ -11,12 +11,6 @@ else inline=false fi -agent_file="$HOME/.local/state/omarchy/defaults/agent" - -if [[ ! -s $agent_file ]]; then - exec omarchy-menu summon setup.default.agent -fi - agent=$(omarchy-default-agent) if omarchy-cmd-missing "$agent"; then diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index 1c284867..3ac8feeb 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -15,7 +15,6 @@ launch_log="$test_tmp/launch" inline_log="$test_tmp/inline" mise_log="$test_tmp/mise" mise_history="$test_tmp/mise-history" -picker_log="$test_tmp/picker" stub_log="$test_tmp/stubs" mkdir -p "$mock_bin" "$test_home" @@ -35,11 +34,6 @@ cat >"$mock_bin/omarchy-launch-tui" <<'SH' printf '%s\0' "$@" >"$OMARCHY_TEST_AGENT_LAUNCH_LOG" SH -cat >"$mock_bin/omarchy-menu" <<'SH' -#!/bin/bash -printf '%s\0' "$@" >"$OMARCHY_TEST_AGENT_PICKER_LOG" -SH - cat >"$mock_bin/opencode" <<'SH' #!/bin/bash printf '%s\0' opencode "$@" >"$OMARCHY_TEST_AGENT_INLINE_LOG" @@ -80,7 +74,6 @@ export OMARCHY_TEST_NOTIFICATION_LOG="$notification_log" export OMARCHY_TEST_NOTIFICATION_HISTORY="$notification_history" export OMARCHY_TEST_AGENT_LAUNCH_LOG="$launch_log" export OMARCHY_TEST_AGENT_INLINE_LOG="$inline_log" -export OMARCHY_TEST_AGENT_PICKER_LOG="$picker_log" export OMARCHY_TEST_MISE_LOG="$mise_log" export OMARCHY_TEST_MISE_HISTORY="$mise_history" export OMARCHY_TEST_STUB_LOG="$stub_log" @@ -144,10 +137,10 @@ pass "Remove Preinstalls deletes every optional agent lazy stub" pass "default agent falls back to OpenCode" omarchy-launch-agent -mapfile -d '' -t picker_args <"$picker_log" -[[ ${picker_args[0]} == "summon" && ${picker_args[1]} == "setup.default.agent" ]] || - fail "agent launcher opens the picker before a default is selected" -pass "agent launcher opens the picker before a default is selected" +mapfile -d '' -t launch_args <"$launch_log" +[[ ${#launch_args[@]} == 1 && ${launch_args[0]} == "opencode" ]] || + fail "agent launcher falls back to OpenCode before a default is selected" +pass "agent launcher falls back to OpenCode before a default is selected" source "$ROOT/default/bash/aliases" [[ $(alias a) == "alias a='omarchy-launch-agent --inline'" ]] || From a7cc924a10c75b22f275ee0627b0f63d7fef6968 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Aug 2026 07:45:36 -0700 Subject: [PATCH 07/10] Show agent installation progress in a terminal --- bin/omarchy-default-agent | 20 ++++++---- test/shell.d/default-agent-test.sh | 63 +++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 26 deletions(-) diff --git a/bin/omarchy-default-agent b/bin/omarchy-default-agent index d131ad00..c4291df9 100755 --- a/bin/omarchy-default-agent +++ b/bin/omarchy-default-agent @@ -4,7 +4,13 @@ # omarchy:args=[pi|omp|opencode|claude|codex|grok|gemini|copilot|crush] # omarchy:examples=omarchy default agent | omarchy default agent codex | omarchy default agent claude -agent_file="$HOME/.local/state/omarchy/defaults/agent" +installing=false +if [[ ${1:-} == "--install" ]]; then + installing=true + shift +fi + +agent_file="$HOME/.config/omarchy/defaults/agent" if (($# == 0)); then if [[ -f $agent_file ]]; then @@ -32,16 +38,14 @@ copilot | github-copilot) agent="copilot"; name="GitHub Copilot" ;; esac agent_package=${agent_package:-$agent} -installing=false -if ! mise where "$agent_package" &>/dev/null; then - installing=true - omarchy-notification-send -g 󰚩 "Installing $name with mise" "This might take a few minutes..." +if [[ $installing == "false" ]] && ! mise where "$agent_package" &>/dev/null; then + exec omarchy-launch-floating-terminal-with-presentation omarchy-default-agent --install "$agent" fi if ! mise use -g "$agent_package"; then if [[ $installing == "true" ]]; then - omarchy-notification-send -g 󰚩 "Could not install $name with mise" + echo "Could not install $name with mise" >&2 else omarchy-notification-send -g 󰚩 "Could not set $name as the default coding agent" fi @@ -51,4 +55,6 @@ fi mkdir -p "$(dirname "$agent_file")" printf '%s\n' "$agent" >"$agent_file" -omarchy-notification-send -g 󰚩 "$name is now the default coding agent" +if [[ $installing == "false" ]]; then + omarchy-notification-send -g 󰚩 "$name is now the default coding agent" +fi diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index 3ac8feeb..05588a39 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -9,6 +9,7 @@ trap 'rm -rf "$test_tmp"' EXIT mock_bin="$test_tmp/bin" test_home="$test_tmp/home" +agent_file="$test_home/.config/omarchy/defaults/agent" notification_log="$test_tmp/notifications" notification_history="$test_tmp/notification-history" launch_log="$test_tmp/launch" @@ -16,6 +17,7 @@ inline_log="$test_tmp/inline" mise_log="$test_tmp/mise" mise_history="$test_tmp/mise-history" stub_log="$test_tmp/stubs" +terminal_log="$test_tmp/terminal" mkdir -p "$mock_bin" "$test_home" cat >"$mock_bin/omarchy-notification-send" <<'SH' @@ -34,6 +36,11 @@ cat >"$mock_bin/omarchy-launch-tui" <<'SH' printf '%s\0' "$@" >"$OMARCHY_TEST_AGENT_LAUNCH_LOG" SH +cat >"$mock_bin/omarchy-launch-floating-terminal-with-presentation" <<'SH' +#!/bin/bash +printf '%s\0' "$@" >"$OMARCHY_TEST_AGENT_TERMINAL_LOG" +SH + cat >"$mock_bin/opencode" <<'SH' #!/bin/bash printf '%s\0' opencode "$@" >"$OMARCHY_TEST_AGENT_INLINE_LOG" @@ -77,6 +84,7 @@ export OMARCHY_TEST_AGENT_INLINE_LOG="$inline_log" export OMARCHY_TEST_MISE_LOG="$mise_log" export OMARCHY_TEST_MISE_HISTORY="$mise_history" export OMARCHY_TEST_STUB_LOG="$stub_log" +export OMARCHY_TEST_AGENT_TERMINAL_LOG="$terminal_log" grok_package="npm:@xai-official/grok" omp_package="github:can1357/oh-my-pi" @@ -183,7 +191,7 @@ declare -A expected_packages=( for selection in "${!expected_agents[@]}"; do expected=${expected_agents[$selection]} - omarchy-default-agent "$selection" + OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent "$selection" [[ $(omarchy-default-agent) == $expected ]] || fail "default agent canonicalizes $selection" mapfile -d '' -t mise_args <"$mise_log" @@ -191,26 +199,42 @@ for selection in "${!expected_agents[@]}"; do fail "default agent installs $selection globally through mise" done pass "default agent installs and accepts every supported provider and alias" +[[ -f $agent_file && ! -e $test_home/.local/state/omarchy/defaults/agent ]] || + fail "default agent stores its selection in Omarchy user config" +pass "default agent stores its selection in Omarchy user config" + +OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent pi +: >"$notification_history" +: >"$terminal_log" +omarchy-default-agent github-copilot +mapfile -d '' -t terminal_args <"$terminal_log" +[[ ${terminal_args[0]} == "omarchy-default-agent" && ${terminal_args[1]} == "--install" && ${terminal_args[2]} == "copilot" ]] || + fail "missing agent installation opens in a terminal" +[[ ! -s $notification_history ]] || fail "missing agent installation skips notifications" +[[ $(omarchy-default-agent) == "pi" ]] || fail "missing agent installation waits to change the selection" + +omarchy-default-agent --install github-copilot +mapfile -d '' -t mise_args <"$mise_log" +[[ ${mise_args[0]} == "use" && ${mise_args[1]} == "-g" && ${mise_args[2]} == "copilot" ]] || + fail "visible agent installation activates the provider globally through mise" +[[ $(omarchy-default-agent) == "copilot" ]] || fail "visible agent installation changes the selection after mise succeeds" +[[ ! -s $notification_history ]] || fail "visible agent installation leaves progress to the terminal" +pass "missing agents install visibly without notifications" : >"$notification_history" -omarchy-default-agent github-copilot +: >"$terminal_log" +OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent github-copilot +[[ ! -s $terminal_log ]] || fail "installed agent selection skips the terminal" mapfile -d '' -t notification_args <"$notification_log" [[ ${notification_args[0]} == "-g" && ${notification_args[2]} == "GitHub Copilot is now the default coding agent" ]] || fail "default agent sends a selection notification" mapfile -d '' -t notification_history_args <"$notification_history" -[[ ${notification_history_args[2]} == "Installing GitHub Copilot with mise" && ${notification_history_args[3]} == "This might take a few minutes..." ]] || - fail "default agent describes how long installation might take" -pass "default agent sends installation and selection notifications" - -: >"$notification_history" -OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent github-copilot -mapfile -d '' -t notification_history_args <"$notification_history" [[ ${#notification_history_args[@]} == 3 && ${notification_history_args[2]} == "GitHub Copilot is now the default coding agent" ]] || - fail "default agent skips installation notifications when the provider is already installed" + fail "installed agent selection sends only the completion notification" mapfile -d '' -t mise_args <"$mise_log" [[ ${mise_args[0]} == "use" && ${mise_args[1]} == "-g" && ${mise_args[2]} == "copilot" ]] || fail "default agent still activates an installed provider globally through mise" -pass "default agent only sends installation notifications for missing providers" +pass "installed agents select immediately with a notification" if omarchy-default-agent unsupported >"$test_tmp/invalid-output" 2>&1; then fail "default agent rejects unsupported providers" @@ -220,13 +244,14 @@ grep -F "Usage: omarchy-default-agent" "$test_tmp/invalid-output" >/dev/null || [[ $(omarchy-default-agent) == "copilot" ]] || fail "invalid selection preserves the current default agent" pass "default agent rejects unsupported providers without changing the selection" -if OMARCHY_TEST_MISE_FAIL=true omarchy-default-agent codex >"$test_tmp/install-failure-output" 2>&1; then +: >"$notification_history" +if OMARCHY_TEST_MISE_FAIL=true omarchy-default-agent --install codex >"$test_tmp/install-failure-output" 2>&1; then fail "default agent rejects a failed mise installation" fi [[ $(omarchy-default-agent) == "copilot" ]] || fail "failed installation preserves the current default agent" -mapfile -d '' -t notification_args <"$notification_log" -[[ ${notification_args[2]} == "Could not install Codex with mise" ]] || - fail "default agent reports a failed mise installation" +grep -F "Could not install Codex with mise" "$test_tmp/install-failure-output" >/dev/null || + fail "default agent reports a failed mise installation in the terminal" +[[ ! -s $notification_history ]] || fail "failed visible agent installation skips notifications" pass "default agent changes selection only after mise installs the provider" : >"$notification_history" @@ -247,7 +272,7 @@ assert_launch() { shift local expected=("$@") - printf '%s\n' "$agent" >"$test_home/.local/state/omarchy/defaults/agent" + printf '%s\n' "$agent" >"$agent_file" omarchy-launch-agent "Review this" project mapfile -d '' -t actual <"$launch_log" @@ -274,14 +299,14 @@ pass "agent launcher adapts initial prompts for every supported agent" mkdir -p "$test_home/.local/bin" touch "$test_home/.local/bin/gemini" chmod +x "$test_home/.local/bin/gemini" -printf '%s\n' "gemini" >"$test_home/.local/state/omarchy/defaults/agent" +printf '%s\n' "gemini" >"$agent_file" OMARCHY_TEST_MISSING_COMMAND=gemini omarchy-launch-agent "Review this project" mapfile -d '' -t launch_args <"$launch_log" [[ ${launch_args[0]} == "gemini" && ${launch_args[1]} == "--prompt-interactive" ]] || fail "agent launcher finds a lazy wrapper outside the session PATH" pass "agent launcher finds lazy wrappers outside the session PATH" -printf '%s\n' "opencode" >"$test_home/.local/state/omarchy/defaults/agent" +printf '%s\n' "opencode" >"$agent_file" omarchy-launch-agent mapfile -d '' -t launch_args <"$launch_log" [[ ${#launch_args[@]} == 1 && ${launch_args[0]} == "opencode" ]] || @@ -294,7 +319,7 @@ mapfile -d '' -t inline_args <"$inline_log" fail "inline agent launcher runs in the current terminal" pass "inline agent launcher runs in the current terminal" -printf '%s\n' "missing" >"$test_home/.local/state/omarchy/defaults/agent" +printf '%s\n' "missing" >"$agent_file" if OMARCHY_TEST_MISSING_COMMAND=missing omarchy-launch-agent >"$test_tmp/missing-output" 2>&1; then fail "agent launcher rejects a missing default command" fi From f293e9df267e22367af57b26acf8a12cf1e6e4f0 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Aug 2026 09:03:50 -0700 Subject: [PATCH 08/10] Open agents after setting the default --- bin/omarchy-default-agent | 11 ++++-- test/shell.d/default-agent-test.sh | 63 ++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/bin/omarchy-default-agent b/bin/omarchy-default-agent index c4291df9..493522b5 100755 --- a/bin/omarchy-default-agent +++ b/bin/omarchy-default-agent @@ -1,6 +1,6 @@ #!/bin/bash -# omarchy:summary=Set the default coding agent used by omarchy-launch-agent +# omarchy:summary=Set and launch the default coding agent # omarchy:args=[pi|omp|opencode|claude|codex|grok|gemini|copilot|crush] # omarchy:examples=omarchy default agent | omarchy default agent codex | omarchy default agent claude @@ -47,7 +47,7 @@ if ! mise use -g "$agent_package"; then if [[ $installing == "true" ]]; then echo "Could not install $name with mise" >&2 else - omarchy-notification-send -g 󰚩 "Could not set $name as the default coding agent" + echo "Could not set $name as the default coding agent" >&2 fi exit 1 fi @@ -55,6 +55,9 @@ fi mkdir -p "$(dirname "$agent_file")" printf '%s\n' "$agent" >"$agent_file" -if [[ $installing == "false" ]]; then - omarchy-notification-send -g 󰚩 "$name is now the default coding agent" +if [[ $installing == "true" ]]; then + printf '\033[2J\033[3J\033[H' + exec omarchy-launch-agent --inline +else + exec omarchy-launch-agent fi diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index 05588a39..449b99c7 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -10,8 +10,8 @@ trap 'rm -rf "$test_tmp"' EXIT mock_bin="$test_tmp/bin" test_home="$test_tmp/home" agent_file="$test_home/.config/omarchy/defaults/agent" -notification_log="$test_tmp/notifications" notification_history="$test_tmp/notification-history" +agent_open_log="$test_tmp/agent-open" launch_log="$test_tmp/launch" inline_log="$test_tmp/inline" mise_log="$test_tmp/mise" @@ -22,7 +22,6 @@ mkdir -p "$mock_bin" "$test_home" cat >"$mock_bin/omarchy-notification-send" <<'SH' #!/bin/bash -printf '%s\0' "$@" >"$OMARCHY_TEST_NOTIFICATION_LOG" printf '%s\0' "$@" >>"$OMARCHY_TEST_NOTIFICATION_HISTORY" SH @@ -77,8 +76,8 @@ chmod +x "$mock_bin"/* export HOME="$test_home" export PATH="$mock_bin:$ROOT/bin:$PATH" -export OMARCHY_TEST_NOTIFICATION_LOG="$notification_log" export OMARCHY_TEST_NOTIFICATION_HISTORY="$notification_history" +export OMARCHY_TEST_AGENT_OPEN_LOG="$agent_open_log" export OMARCHY_TEST_AGENT_LAUNCH_LOG="$launch_log" export OMARCHY_TEST_AGENT_INLINE_LOG="$inline_log" export OMARCHY_TEST_MISE_LOG="$mise_log" @@ -160,6 +159,13 @@ grep -Fq 'o.bind("SUPER + SHIFT + CTRL + A", "Agent", "omarchy-launch-agent")' \ fail "agent launcher has a keyboard shortcut" pass "agent launcher has a keyboard shortcut" +cat >"$mock_bin/omarchy-launch-agent" <<'SH' +#!/bin/bash +printf '%s\0' omarchy-launch-agent "$@" >"$OMARCHY_TEST_AGENT_OPEN_LOG" +SH +chmod +x "$mock_bin/omarchy-launch-agent" +hash -r + declare -A expected_agents=( [pi]="pi" [omp]="omp" @@ -191,60 +197,74 @@ declare -A expected_packages=( for selection in "${!expected_agents[@]}"; do expected=${expected_agents[$selection]} + : >"$agent_open_log" OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent "$selection" [[ $(omarchy-default-agent) == $expected ]] || fail "default agent canonicalizes $selection" mapfile -d '' -t mise_args <"$mise_log" [[ ${mise_args[0]} == "use" && ${mise_args[1]} == "-g" && ${mise_args[2]} == ${expected_packages[$expected]} ]] || fail "default agent installs $selection globally through mise" + + mapfile -d '' -t agent_open_args <"$agent_open_log" + [[ ${#agent_open_args[@]} == 1 && ${agent_open_args[0]} == "omarchy-launch-agent" ]] || + fail "default agent opens $selection after selecting it" done -pass "default agent installs and accepts every supported provider and alias" +pass "default agent selects and opens every supported provider and alias" [[ -f $agent_file && ! -e $test_home/.local/state/omarchy/defaults/agent ]] || fail "default agent stores its selection in Omarchy user config" pass "default agent stores its selection in Omarchy user config" OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent pi : >"$notification_history" +: >"$agent_open_log" : >"$terminal_log" omarchy-default-agent github-copilot mapfile -d '' -t terminal_args <"$terminal_log" [[ ${terminal_args[0]} == "omarchy-default-agent" && ${terminal_args[1]} == "--install" && ${terminal_args[2]} == "copilot" ]] || fail "missing agent installation opens in a terminal" [[ ! -s $notification_history ]] || fail "missing agent installation skips notifications" +[[ ! -s $agent_open_log ]] || fail "missing agent installation waits to open the agent" [[ $(omarchy-default-agent) == "pi" ]] || fail "missing agent installation waits to change the selection" -omarchy-default-agent --install github-copilot +omarchy-default-agent --install github-copilot >"$test_tmp/install-output" mapfile -d '' -t mise_args <"$mise_log" [[ ${mise_args[0]} == "use" && ${mise_args[1]} == "-g" && ${mise_args[2]} == "copilot" ]] || fail "visible agent installation activates the provider globally through mise" [[ $(omarchy-default-agent) == "copilot" ]] || fail "visible agent installation changes the selection after mise succeeds" [[ ! -s $notification_history ]] || fail "visible agent installation leaves progress to the terminal" -pass "missing agents install visibly without notifications" +[[ $(<"$test_tmp/install-output") == $'\033[2J\033[3J\033[H' ]] || + fail "visible agent installation clears its terminal before opening the agent" +mapfile -d '' -t agent_open_args <"$agent_open_log" +[[ ${#agent_open_args[@]} == 2 && ${agent_open_args[0]} == "omarchy-launch-agent" && ${agent_open_args[1]} == "--inline" ]] || + fail "newly installed agent opens in the installation terminal" +pass "missing agents install visibly and open in the same terminal" : >"$notification_history" +: >"$agent_open_log" : >"$terminal_log" OMARCHY_TEST_AGENT_INSTALLED=true omarchy-default-agent github-copilot [[ ! -s $terminal_log ]] || fail "installed agent selection skips the terminal" -mapfile -d '' -t notification_args <"$notification_log" -[[ ${notification_args[0]} == "-g" && ${notification_args[2]} == "GitHub Copilot is now the default coding agent" ]] || - fail "default agent sends a selection notification" -mapfile -d '' -t notification_history_args <"$notification_history" -[[ ${#notification_history_args[@]} == 3 && ${notification_history_args[2]} == "GitHub Copilot is now the default coding agent" ]] || - fail "installed agent selection sends only the completion notification" +[[ ! -s $notification_history ]] || fail "installed agent selection skips notifications" mapfile -d '' -t mise_args <"$mise_log" [[ ${mise_args[0]} == "use" && ${mise_args[1]} == "-g" && ${mise_args[2]} == "copilot" ]] || fail "default agent still activates an installed provider globally through mise" -pass "installed agents select immediately with a notification" +mapfile -d '' -t agent_open_args <"$agent_open_log" +[[ ${#agent_open_args[@]} == 1 && ${agent_open_args[0]} == "omarchy-launch-agent" ]] || + fail "installed agent opens in a new terminal after selection" +pass "installed agents select and open without notifications" +: >"$agent_open_log" if omarchy-default-agent unsupported >"$test_tmp/invalid-output" 2>&1; then fail "default agent rejects unsupported providers" fi grep -F "Usage: omarchy-default-agent" "$test_tmp/invalid-output" >/dev/null || fail "default agent explains supported providers" [[ $(omarchy-default-agent) == "copilot" ]] || fail "invalid selection preserves the current default agent" +[[ ! -s $agent_open_log ]] || fail "invalid selection does not open an agent" pass "default agent rejects unsupported providers without changing the selection" : >"$notification_history" +: >"$agent_open_log" if OMARCHY_TEST_MISE_FAIL=true omarchy-default-agent --install codex >"$test_tmp/install-failure-output" 2>&1; then fail "default agent rejects a failed mise installation" fi @@ -252,20 +272,23 @@ fi grep -F "Could not install Codex with mise" "$test_tmp/install-failure-output" >/dev/null || fail "default agent reports a failed mise installation in the terminal" [[ ! -s $notification_history ]] || fail "failed visible agent installation skips notifications" -pass "default agent changes selection only after mise installs the provider" +[[ ! -s $agent_open_log ]] || fail "failed installation does not open an agent" +pass "default agent opens only after mise installs the provider" : >"$notification_history" +: >"$agent_open_log" if OMARCHY_TEST_AGENT_INSTALLED=true OMARCHY_TEST_MISE_FAIL=true omarchy-default-agent codex >"$test_tmp/setup-failure-output" 2>&1; then fail "default agent rejects a failed mise activation" fi [[ $(omarchy-default-agent) == "copilot" ]] || fail "failed activation preserves the current default agent" -mapfile -d '' -t notification_args <"$notification_log" -[[ ${notification_args[2]} == "Could not set Codex as the default coding agent" ]] || +grep -F "Could not set Codex as the default coding agent" "$test_tmp/setup-failure-output" >/dev/null || fail "default agent reports a failed activation for an installed provider" -mapfile -d '' -t notification_history_args <"$notification_history" -[[ ${#notification_history_args[@]} == 3 ]] || - fail "failed activation sends only the selection failure notification" -pass "default agent reports mise failures for installed providers" +[[ ! -s $notification_history ]] || fail "failed activation skips notifications" +[[ ! -s $agent_open_log ]] || fail "failed activation does not open an agent" +pass "default agent reports mise failures without notifications" + +rm "$mock_bin/omarchy-launch-agent" +hash -r assert_launch() { local agent=$1 From 884ee6943a5ae8e71d45fd6a2c251b146f867993 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Aug 2026 10:04:21 -0700 Subject: [PATCH 09/10] Use official agent marks in default menu --- default/fonts/omarchy/README.md | 13 +++++++++++++ default/fonts/omarchy/omarchy.ttf | Bin 1824 -> 2572 bytes default/omarchy/omarchy-menu.jsonc | 10 +++++----- test/shell.d/menu-test.sh | 15 ++++++++++----- 4 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 default/fonts/omarchy/README.md diff --git a/default/fonts/omarchy/README.md b/default/fonts/omarchy/README.md new file mode 100644 index 00000000..8eb3c441 --- /dev/null +++ b/default/fonts/omarchy/README.md @@ -0,0 +1,13 @@ +# Omarchy icon font + +The private-use glyphs in `omarchy.ttf` are: + +- `U+E900` — Omarchy +- `U+E901` — Pi, from +- `U+E902` — OpenCode, from +- `U+E903` — omp, from +- `U+E904` — Grok, from +- `U+E905` — Codex, from the OpenAI mark on + +The agent marks are monochrome so the menu can render them using the active +theme's foreground and selection colors. diff --git a/default/fonts/omarchy/omarchy.ttf b/default/fonts/omarchy/omarchy.ttf index 273256d07549caa5de9121fc13110e9b704b63d5..a548aec1c293fdc3c3927afaa2084703a37a2348 100644 GIT binary patch literal 2572 zcmc&$Z){Ul6hHU9wy%Gnbo9@IF{Eo*OXk*Y?b^rRF_3kjSpIDwG6P-rx`F+dQV0`N zrU?m#WFn|IqGI%m5+z}N#AF`~QGpnjm>4y(4~j0vXpAO)V4c7F`XmGVYP`4So^yWZ zocqqb@4S0UjEHP>oJ4Br+R?M#d$nPN$Z`Q_cFT@%Wak%~x`^0v==;*SRPopI7oLIs z36WqQ$PQ(0|Mql=Nc;=*)S#N`51p6;nXZ81g8zU9jue@f-hzDrbZnxE}26nAjI9MLOn7)PlI$+;RJa-n2 z<}Yvla__v=f0E4rfav?rKRv|xtyiz@;M{b zq7%(<70o~;_97W!Iw@R-K2qiEXNoYy2xJsBzx#%*na+M1r_@w6hh9Uk=5lui63439 z-8aD<0QL?Vr5wf%fXD@Jk*Ep8Lr-aIAY>zIQWH2|!6{hxfxE~7#6T%Z(;#LkP>F`7 zXv#Rl*LW|=W@cvIMt^hWm6BQlfC)hEFF?lwnLkLjQVJf#!QE3K0Wd{8I8-keT+ z4F#R}zN5Z0;_DmI2|GLmkrU5hiW9fvS&Yy7UpE73PtjhJ$g6`t9IaX{Rr&uP*U;Vl zaqQ~}Y}Q9eO-oq&GHfK%B3eRzBBkD4UxOY4F_5PDV^J1$`<)=p6YS>nHwLPd*v8wZ z#L)BtcD`~^=uMujq?1V@nXCjSCK3q)-KKPPIcoOFDdIAoy;!OMg2zMXr*V(GM_O}U%xvYR_#9b>gSI}!V$L6=~9-|cjto?~C+ai)U%qr`a2lw{v@%e*-tHtIr*G8j}XJ1&? zvaQQEKj35*)LsW|z`kC=cfEu{6r)b+rUAnF$zpAa5|2ha9=FRS1p|^Z))ovZaarbw zNooiNVzIV3JY>n_u91T=MRrS0A6#NJvd0Y{lfN|>3bf|9SQ${q!fB*8la8vY6j%XkH$! ztlea8O13JYOODqE(H`Q`CQEa&bprMkVaIpyv_`fxGxmYQag$H-ZG2C=t@Yt$!KLPQ zbyb7!fvwH=Bf?O(&DiH`Nj4d+rU9$968~(z<+(%TQS z6PSo)Y{eVt!DAnxUOLYV%*ad(Z(H9*bD^l_(}jLjEaZxYfl}c~BiD{pE5k}H)K0>N z#O7|YXH(@o)!zAY!0^z2{wQ#nW%m!Hw0lU?VB=N>gi)Q&4d4>qr2)49uOV(@B>WBT CGLoPG delta 787 zcmZvYF=!M~5QhKR+r8V}lS|M`2q<#mMI|1|MO0FV+Nq!j1`k9~*UOp>?A{)C3FK6~ zA{K&I7*;IOXpz!N!9olcT4-ggY*Q#=uaYkQZ}Y$e@`ho)nRzqw-t>wu3Qq>RG65jG zJUMo(_VvO!K$hv>sz+Y))#LsiU>u>k(_!b%`=td7FwZl8Kk&V&%F4H&JRdpGroWMJjV=_U0fU53kPNJtvm+Rr2resMe^K< zk_ma(C94}5YK6*1vXu4*o-(Q?RcKksxQT%NZuB!^z(bvWgcvP!eqlp(-YLfLmLshH zF9QnI*er5sQwuia^{SDRzFlcmQ`g$blySS5I;XKslJ(5Jq@5e-7WBhS_8QP^A&-5U z)eJ5=?cw4mMm6WL2iMeRO|{wrLd^#GuI3E+k!F+pOtXbSEN}8fexiW4I^m**Pnz>M zB>UsYYt@6!6@Pjz^jg}}rslWWGjXFdK3dh0WYWHVCgyfMZddKO!#!{HYVet9V}|ht vN*L#Ns@v}*AM6LoS?9o*BZg$e6ic#_6I&c{k<)`DmPkBlNnHZzq`UbCU?YRJ diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index 203318d9..2806fe12 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -133,14 +133,14 @@ "setup.default": {"icon":"","label":"Defaults","aliases":["default","defaults"]}, "setup.default.agent": {"icon":"󰚩","label":"Agent"}, "setup.default.agent.claude": {"icon":"󰛄","label":"Claude","checked":"[[ \"$(omarchy-default-agent)\" == \"claude\" ]]","action":"omarchy-default-agent claude"}, - "setup.default.agent.codex": {"icon":"󰞵","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"}, + "setup.default.agent.codex": {"icon":"","iconFont":"omarchy","label":"Codex","checked":"[[ \"$(omarchy-default-agent)\" == \"codex\" ]]","action":"omarchy-default-agent codex"}, "setup.default.agent.copilot": {"icon":"","label":"Copilot","checked":"[[ \"$(omarchy-default-agent)\" == \"copilot\" ]]","action":"omarchy-default-agent copilot"}, "setup.default.agent.crush": {"icon":"󰋑","label":"Crush","checked":"[[ \"$(omarchy-default-agent)\" == \"crush\" ]]","action":"omarchy-default-agent crush"}, "setup.default.agent.gemini": {"icon":"󰫢","label":"Gemini","checked":"[[ \"$(omarchy-default-agent)\" == \"gemini\" ]]","action":"omarchy-default-agent gemini"}, - "setup.default.agent.grok": {"icon":"󰰱","label":"Grok","checked":"[[ \"$(omarchy-default-agent)\" == \"grok\" ]]","action":"omarchy-default-agent grok"}, - "setup.default.agent.omp": {"icon":"󰣪","label":"omp","checked":"[[ \"$(omarchy-default-agent)\" == \"omp\" ]]","action":"omarchy-default-agent omp"}, - "setup.default.agent.opencode": {"icon":"󰕪","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, - "setup.default.agent.pi": {"icon":"󰏿","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, + "setup.default.agent.grok": {"icon":"","iconFont":"omarchy","label":"Grok","checked":"[[ \"$(omarchy-default-agent)\" == \"grok\" ]]","action":"omarchy-default-agent grok"}, + "setup.default.agent.omp": {"icon":"","iconFont":"omarchy","label":"omp","checked":"[[ \"$(omarchy-default-agent)\" == \"omp\" ]]","action":"omarchy-default-agent omp"}, + "setup.default.agent.opencode": {"icon":"","iconFont":"omarchy","label":"OpenCode","checked":"[[ \"$(omarchy-default-agent)\" == \"opencode\" ]]","action":"omarchy-default-agent opencode"}, + "setup.default.agent.pi": {"icon":"","iconFont":"omarchy","label":"Pi","checked":"[[ \"$(omarchy-default-agent)\" == \"pi\" ]]","action":"omarchy-default-agent pi"}, "setup.default.browser": {"icon":"","label":"Browser"}, "setup.default.browser.chromium": {"icon":"","label":"Chromium","when":"omarchy-cmd-present chromium","checked":"[[ \"$(omarchy-default-browser)\" == \"chromium\" ]]","action":"omarchy-default-browser chromium"}, "setup.default.browser.chrome": {"icon":"󰊯","label":"Chrome","when":"omarchy-cmd-present google-chrome-stable","checked":"[[ \"$(omarchy-default-browser)\" == \"chrome\" ]]","action":"omarchy-default-browser chrome"}, diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index d7621e18..ccb8ce7f 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -168,12 +168,12 @@ assertEqual( 'menu lists Direct Boot immediately below Input' ) const expectedAgents = { - pi: { icon: '󰏿', label: 'Pi' }, - omp: { icon: '󰣪', label: 'omp' }, - opencode: { icon: '󰕪', label: 'OpenCode' }, + pi: { icon: '\ue901', iconFont: 'omarchy', label: 'Pi' }, + omp: { icon: '\ue903', iconFont: 'omarchy', label: 'omp' }, + opencode: { icon: '\ue902', iconFont: 'omarchy', label: 'OpenCode' }, claude: { icon: '󰛄', label: 'Claude' }, - codex: { icon: '󰞵', label: 'Codex' }, - grok: { icon: '󰰱', label: 'Grok' }, + codex: { icon: '\ue905', iconFont: 'omarchy', label: 'Codex' }, + grok: { icon: '\ue904', iconFont: 'omarchy', label: 'Grok' }, gemini: { icon: '󰫢', label: 'Gemini' }, copilot: { icon: '', label: 'Copilot' }, crush: { icon: '󰋑', label: 'Crush' }, @@ -183,6 +183,7 @@ assert( const entry = defaultById[`setup.default.agent.${agent}`] return entry && entry.icon === expected.icon + && entry.iconFont === (expected.iconFont || '') && entry.label === expected.label && entry.action === `omarchy-default-agent ${agent}` && !entry.when @@ -483,3 +484,7 @@ assert( 'mouse activation carries pointer intent into subordinate menus' ) JS + +font_charset=$(fc-query --format='%{charset}' "$ROOT/default/fonts/omarchy/omarchy.ttf") +[[ $font_charset == *"e900-e905"* ]] || fail "Omarchy icon font includes every custom menu glyph" +pass "Omarchy icon font includes the official agent marks" From 3636c76e963af3a28ca355517da0aecdbb26845e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Aug 2026 10:04:26 -0700 Subject: [PATCH 10/10] Rely on the session PATH for agent launches --- bin/omarchy-launch-agent | 8 ++------ test/shell.d/default-agent-test.sh | 10 ---------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/bin/omarchy-launch-agent b/bin/omarchy-launch-agent index 0c619b09..b86a7bc0 100755 --- a/bin/omarchy-launch-agent +++ b/bin/omarchy-launch-agent @@ -14,12 +14,8 @@ fi agent=$(omarchy-default-agent) if omarchy-cmd-missing "$agent"; then - if [[ -x $HOME/.local/bin/$agent ]]; then - export PATH="$HOME/.local/bin:$PATH" - else - echo "$agent is not installed. Choose an installed agent with: omarchy default agent " >&2 - exit 1 - fi + echo "$agent is not installed. Choose an installed agent with: omarchy default agent " >&2 + exit 1 fi if (($# > 0)); then diff --git a/test/shell.d/default-agent-test.sh b/test/shell.d/default-agent-test.sh index 449b99c7..9ffeb63e 100644 --- a/test/shell.d/default-agent-test.sh +++ b/test/shell.d/default-agent-test.sh @@ -319,16 +319,6 @@ assert_launch gemini gemini --prompt-interactive "Review this project" assert_launch copilot copilot --interactive "Review this project" pass "agent launcher adapts initial prompts for every supported agent" -mkdir -p "$test_home/.local/bin" -touch "$test_home/.local/bin/gemini" -chmod +x "$test_home/.local/bin/gemini" -printf '%s\n' "gemini" >"$agent_file" -OMARCHY_TEST_MISSING_COMMAND=gemini omarchy-launch-agent "Review this project" -mapfile -d '' -t launch_args <"$launch_log" -[[ ${launch_args[0]} == "gemini" && ${launch_args[1]} == "--prompt-interactive" ]] || - fail "agent launcher finds a lazy wrapper outside the session PATH" -pass "agent launcher finds lazy wrappers outside the session PATH" - printf '%s\n' "opencode" >"$agent_file" omarchy-launch-agent mapfile -d '' -t launch_args <"$launch_log"