* Apply agent account selection to CLI subprocesses * Fix account dispatch edge cases and remove redundant shell wrappers * Use the current account when launching a new agent session
63 lines
2.5 KiB
Plaintext
63 lines
2.5 KiB
Plaintext
# Single source of truth for OMARCHY_PATH + PATH adjustments. Sourced by:
|
|
# /etc/profile.d/omarchy.sh (system login shells)
|
|
# /etc/skel/.bashrc (interactive shells)
|
|
# /usr/share/uwsm/env.d/10-omarchy (Hyprland session via uwsm)
|
|
# /usr/share/omarchy/default/bash/envs (bash rc chain; SSH/non-login)
|
|
|
|
# /etc/omarchy.conf is written by omarchy-dev-link and reset by
|
|
# omarchy-dev-unlink. When absent, force the packaged default instead of
|
|
# preserving a stale inherited value.
|
|
if [ -f /etc/omarchy.conf ]; then
|
|
. /etc/omarchy.conf
|
|
: "${OMARCHY_PATH:=/usr/share/omarchy}"
|
|
else
|
|
OMARCHY_PATH=/usr/share/omarchy
|
|
fi
|
|
export OMARCHY_PATH
|
|
|
|
# Only prepend in dev-link mode. On a production install, the binaries are
|
|
# already on PATH as /usr/bin/omarchy-* via the omarchy package — prepending
|
|
# /usr/share/omarchy/bin would just be noise.
|
|
if [ "$OMARCHY_PATH" != /usr/share/omarchy ]; then
|
|
case ":$PATH:" in
|
|
*":${OMARCHY_PATH%/}/bin:"*) ;;
|
|
*) PATH="${OMARCHY_PATH%/}/bin${PATH:+:$PATH}" ;;
|
|
esac
|
|
fi
|
|
|
|
# mise's command wrappers must precede real tool directories inherited from a
|
|
# parent shell, so scripts follow account switches without Bash functions.
|
|
# mise activate also keeps this directory ahead of its managed tool binaries.
|
|
omarchy_wrapper_dir="${MISE_DATA_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/mise}/command-wrappers/bin"
|
|
omarchy_wrapper_path=$omarchy_wrapper_dir
|
|
if [ -n "${PATH:-}" ]; then
|
|
omarchy_remaining_path=$PATH
|
|
while :; do
|
|
omarchy_path_entry=${omarchy_remaining_path%%:*}
|
|
if [ "$omarchy_path_entry" != "$omarchy_wrapper_dir" ]; then
|
|
omarchy_wrapper_path="$omarchy_wrapper_path:$omarchy_path_entry"
|
|
fi
|
|
case "$omarchy_remaining_path" in
|
|
*:*) omarchy_remaining_path=${omarchy_remaining_path#*:} ;;
|
|
*) break ;;
|
|
esac
|
|
done
|
|
fi
|
|
PATH=$omarchy_wrapper_path
|
|
unset omarchy_wrapper_dir omarchy_wrapper_path omarchy_remaining_path omarchy_path_entry
|
|
|
|
# User-level tool paths, appended so system binaries keep precedence. This is
|
|
# what lets login shells (ssh, bash -lc) and the uwsm session find mise-managed
|
|
# tools without an interactive rc. Keep these directories in sync with the PAM
|
|
# PATH line from install/config/ssh-command-path.sh, which covers SSH commands
|
|
# that run no shell setup at all.
|
|
case ":$PATH:" in
|
|
*":$HOME/.local/share/mise/shims:"*) ;;
|
|
*) PATH="${PATH:+$PATH:}$HOME/.local/share/mise/shims" ;;
|
|
esac
|
|
case ":$PATH:" in
|
|
*":$HOME/.local/bin:"*) ;;
|
|
*) PATH="${PATH:+$PATH:}$HOME/.local/bin" ;;
|
|
esac
|
|
export PATH
|