Files
omarchycn/bin/omarchy-provision-first-run
T
David Heinemeier HanssonandGitHub 9502b81f3b Reshape the agent launcher into omarchy agent (#6757)
* Reshape the agent launcher into omarchy agent

omarchy-launch-agent becomes omarchy-agent, with prompts on omarchy-agent-prompt
rather than the bare route: `omarchy agent` is both a command and a group, so a
positional prompt there would shadow any subcommand under it. The launcher takes
flags only and points at `omarchy agent prompt` when handed one.

Every agent window now launches under a fixed org.omarchy.agent app-id instead of
omarchy-launch-tui's default of org.omarchy.<binary>, so one rule floats them all
whichever agent is default.

Omarchy also stops picking an agent for you. omarchy-default-agent prints nothing
until one is chosen, leaving every entry under Setup > Defaults > Agent unchecked,
and a first-run invitation offers to take you there.

* Wordsmith

* Cover the agent routes and the invitation

The route split is the point of the change, so exercise `omarchy agent`,
`omarchy agent prompt`, and a rejected positional prompt through the router
rather than only the binaries behind them.

The invitation gets the same treatment as the Voxtype and fingerprint ones: it
notifies once, opens the agent defaults menu, and leaves both the notification
and the marker alone for anyone who already chose an agent.

* Offer the agent choice from the keybinding

Super + Shift + Ctrl + A now runs `omarchy-agent --pick`, which opens Setup >
Defaults > Agent when nothing is chosen yet. A keypress that writes to stderr
and opens nothing just looks broken.

* Reach existing installs with the agent invitation

first-run installs the invitation hook, and existing accounts marked it complete
long ago, so they would never see it -- while being the accounts most likely to
need it, since the old getter returned opencode implicitly and most have no
agent recorded at all. Post-update hooks run later in the same update, so the
invitation arrives without waiting for another one.

* Say what the Defaults submenus set

Setup > Defaults lists Agent, Browser, Terminal, Editor, but the header inside
each repeated the same bare word, which reads as a category rather than a
setting -- and says nothing at all when the menu is summoned straight into it.
The list keeps its short labels; the headers now name the setting.
2026-08-12 17:56:19 +02:00

100 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Finish first-login setup for Omarchy.
# omarchy:args=[--force]
# omarchy:hidden=true
set -e
usage() {
cat <<USAGE
Usage: omarchy-provision-first-run [--force]
Run first-login user setup and notification hooks. By default this only runs
once per user. Use --force to rerun the full sequence and refresh user setup.
USAGE
}
force=0
finalize_user_args=()
while (($#)); do
case "$1" in
--force)
force=1
finalize_user_args+=(--force)
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 1
;;
esac
done
state_dir=~/.local/state/omarchy
FIRST_RUN_DONE="first-run-user"
if omarchy-done check "$FIRST_RUN_DONE" && (( force == 0 )); then
echo "First-run already complete (rerun with --force to refresh)."
exit 0
fi
omarchy-provision-user "${finalize_user_args[@]}" || true
mkdir -p "$state_dir"
FIRST_RUN_LOG="$state_dir/first-run.log"
first_run_failed=0
log_first_run() {
printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*" >>"$FIRST_RUN_LOG"
}
run_first_run_step() {
local name="$1"
shift
log_first_run "Starting: $name"
if "$@"; then
log_first_run "Completed: $name"
else
local status=$?
first_run_failed=1
log_first_run "Failed: $name (exit code: $status)"
fi
}
run_first_run_step "install Voxtype post-update hook" \
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/install-voxtype.hook"
run_first_run_step "install fingerprint setup post-update hook" \
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/setup-fingerprint.hook"
run_first_run_step "install agent setup post-update hook" \
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/setup-agent.hook"
run_first_run_step "enable user systemd units" \
bash "$OMARCHY_PATH/install/user/first-run/enable-user-units.sh"
run_first_run_step "set GNOME theme" \
bash "$OMARCHY_PATH/install/user/first-run/gnome-theme.sh"
run_first_run_step "set GTK primary paste" \
bash "$OMARCHY_PATH/install/user/first-run/gtk-primary-paste.sh"
run_first_run_step "apply speaker tuning" \
bash "$OMARCHY_PATH/install/user/first-run/audio-tuning.sh"
omarchy-notification-wait || log_first_run "Timed out waiting for notification service; continuing"
# Each send returns only once the server has taken the toast, so sending in
# order is enough to stack them newest-on-top.
run_first_run_step "show welcome notification" \
bash "$OMARCHY_PATH/install/user/first-run/welcome.sh"
run_first_run_step "schedule Wi-Fi/update notifications" \
bash "$OMARCHY_PATH/install/user/first-run/wifi.sh"
if (( first_run_failed == 0 )); then
omarchy-done mark "$FIRST_RUN_DONE"
else
log_first_run "One or more first-run steps failed; first-run will retry next login"
fi