OpenClaw's desktop experience on Linux is its Control UI, served by the gateway the openclaw package runs, so the Install > AI entry installs the package and a web app launcher that routes through the new omarchy-launch-openclaw: first launch hands off to OpenClaw's own onboarding wizard, later launches start the gateway when needed and open the dashboard's single-use browser handoff URL as an app window. Remove > AI tears the gateway service down through OpenClaw's own gateway uninstall (falling back to systemctl by hand), aborts rather than dropping the package under a gateway that will not stop, and keeps the user's agent in ~/.openclaw. OpenClaw also joins Setup > Defaults > Agent through the same agent_installer seam Hermes carries: its CLI is the pacman package rather than a mise tool, so omarchy-install-openclaw-cli answers --check/--now with pacman, and omarchy-agent runs `openclaw chat`, seeding prompts through --message. The menu mark is a new U+E90C glyph traced from the package's lobster favicon; E90B stays free for the Perplexity mark still in flight on its own branch. The launcher recovers the gateway through `openclaw gateway install --force` (unit not enabled: missing, or an install that died after writing it) or `openclaw gateway start` (enabled but stopped), never `openclaw dashboard --yes`: as of OpenClaw 2026.9.1 that defers to "the owning supervisor" in both cases, and once the gateway is up it copies a one-time browser pairing URL into the clipboard. The dashboard probe is bounded so an app-grid launch cannot hang without a terminal to interrupt it. Removal treats only systemd's own "inactive"/"failed" as a stopped gateway, so an unreachable user manager aborts instead of dropping the package under a live process. All of it verified against a real 2026.9.1 install. Removal also takes down the node-host unit if OpenClaw ever installed one, and asks (default no, only on a terminal) whether ~/.openclaw should go too, with its size: the chats and credentials live there next to hundreds of megabytes of plugin runtimes and cache OpenClaw downloads for itself. Onboarding goes through omarchy-openclaw-onboard rather than bare `openclaw onboard`: as of 2026.9.1 the bare command is the guided flow, which ends by running a foreground gateway and handing off to a browser tab without returning, so the install script never reached the app launch and no service was installed. The helper runs the classic wizard (--flow quickstart --install-daemon --skip-ui) as a background job that keeps the terminal as its stdin, so its prompts render and take input as upstream draws them, and stops it once the gateway answers: upstream leaves the wizard running after its outro (only the TUI branch exits, and the model sign-in holds a socket open). Every quickstart prompt precedes the service install, so that point is safe. A gateway that never comes up after this run applies setup ends the wait as a failure instead of hanging, an already-running OpenClaw is left alone rather than mistaken for this run's success, a gateway answering on the port is only this run's once its process is the unit's own MainPID (an orphan from an earlier run) is not mistaken for the service this run installs, and a signal at the helper takes the wizard down with it.
85 lines
3.0 KiB
Bash
Executable File
85 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Set and launch the default coding agent
|
|
# omarchy:args=[pi|omp|opencode|ori|claude|codex|grok|openclaw|agy|hermes|copilot|crush]
|
|
# omarchy:examples=omarchy default agent | omarchy default agent codex | omarchy default agent claude
|
|
|
|
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
|
|
read -r agent <"$agent_file"
|
|
fi
|
|
|
|
# Silent when unset rather than defaulting: Omarchy picks no agent for you, so
|
|
# the menu leaves every entry unchecked until one is chosen.
|
|
[[ -n ${agent:-} ]] && echo "$agent"
|
|
exit 0
|
|
fi
|
|
|
|
case "$1" in
|
|
pi) agent="pi"; name="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" ;;
|
|
ori | openrouter) agent="ori"; name="Ori"; agent_package="github:OpenRouterLabs/ori-releases" ;;
|
|
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" ;;
|
|
openclaw) agent="openclaw"; name="OpenClaw"; agent_installer="omarchy-install-openclaw-cli" ;;
|
|
agy | antigravity | antigravity-cli | gemini | gemini-cli) agent="agy"; name="Antigravity"; agent_package="antigravity-cli" ;;
|
|
hermes) agent="hermes"; name="Hermes"; agent_installer="omarchy-install-hermes-cli" ;;
|
|
copilot | github-copilot) agent="copilot"; name="GitHub Copilot" ;;
|
|
*)
|
|
echo "Usage: omarchy-default-agent <pi|omp|opencode|ori|claude|codex|grok|openclaw|agy|hermes|copilot|crush>"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
agent_package=${agent_package:-$agent}
|
|
|
|
# Hermes reaches mise through its own installer rather than straight from
|
|
# here: it needs its interpreter pinned, and a bare `mise use` has nowhere to
|
|
# say so. See omarchy-install-hermes-cli. OpenClaw comes from its pacman
|
|
# package the same way; see omarchy-install-openclaw-cli.
|
|
if [[ -n ${agent_installer:-} ]]; then
|
|
# Not omarchy-cmd-present: the stub is on PATH from first boot and says
|
|
# nothing about whether Hermes is installed behind it. Treating a cold stub
|
|
# as installed skips the floating terminal and runs the minute-long install
|
|
# inside the menu action instead.
|
|
agent_present() { "$agent_installer" --check; }
|
|
agent_install() { "$agent_installer" --now; }
|
|
else
|
|
agent_present() { mise where "$agent_package" &>/dev/null; }
|
|
agent_install() { mise use -g "$agent_package"; }
|
|
fi
|
|
|
|
if [[ $installing == "false" ]] && ! agent_present; then
|
|
exec omarchy-launch-floating-terminal-with-presentation omarchy-default-agent --install "$agent"
|
|
fi
|
|
|
|
if ! agent_install; then
|
|
if [[ $installing == "true" ]]; then
|
|
echo "Could not install $name with mise" >&2
|
|
else
|
|
echo "Could not set $name as the default coding agent" >&2
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$(dirname "$agent_file")"
|
|
printf '%s\n' "$agent" >"$agent_file"
|
|
|
|
if [[ $installing == "true" ]]; then
|
|
printf '\033[2J\033[3J\033[H'
|
|
exec omarchy-agent --inline
|
|
else
|
|
exec omarchy-agent
|
|
fi
|