fix: isolate zellij launcher from local config

This commit is contained in:
2026-04-05 13:00:49 +02:00
parent 8569b4554a
commit b7e48deff5
3 changed files with 40 additions and 9 deletions
+9
View File
@@ -38,6 +38,15 @@ Useful flags:
--recreate
```
By default, the launcher creates a fresh temporary Zellij config directory for each new session.
This is intentional: it avoids interference from an existing user Zellij config, custom default
layouts, plugins, or resurrected session state. If you really want to use a specific Zellij config
directory, pass:
```bash
./scripts/zellij-ai-triple.sh --zellij-config-dir /path/to/zellij-config
```
On first launch of each Codex pane, if `auth.json` is missing in its profile, the pane runs:
```bash
+8 -2
View File
@@ -66,6 +66,12 @@ workspace="${ZELLIJ_AI_WORKSPACE:-$PWD}"
image="${ZELLIJ_AI_CODEX_IMAGE:-codercom/code-server:latest}"
main_codex_config="${ZELLIJ_AI_MAIN_CODEX_CONFIG:-$HOME/.codex/config.toml}"
codex_binary="$(find_codex_binary || true)"
term_value="${ZELLIJ_AI_CODEX_TERM:-${TERM:-xterm-256color}}"
color_term_value="${COLORTERM:-truecolor}"
if [[ "$term_value" == "dumb" ]]; then
term_value="xterm-256color"
fi
if [[ ! -d "$workspace" ]]; then
echo "Workspace not found: $workspace" >&2
@@ -136,8 +142,8 @@ docker_args=(
-e HOME=/codex-home
-e CODEX_HOME=/codex-home
-e USER="${USER:-$(id -un)}"
-e TERM="${TERM:-xterm-256color}"
-e COLORTERM="${COLORTERM:-truecolor}"
-e TERM="$term_value"
-e COLORTERM="$color_term_value"
-e LANG="${LANG:-C.UTF-8}"
-v "${workspace}:/workspace"
-v "${profile_dir}:/codex-home"
+23 -7
View File
@@ -29,6 +29,9 @@ Options:
--codex2-label LABEL Display label for the second Codex pane
default: codex-2
--claude-config DIR Optional CLAUDE_CONFIG_DIR override for the Claude pane
--zellij-config-dir DIR
Optional isolated Zellij config dir to use for session creation
default: a fresh temporary config dir per new session
--recreate Kill the existing session before recreating it
-h, --help Show this help
EOF
@@ -54,6 +57,7 @@ codex2_home="$HOME/.codex-profiles/codex-2"
codex1_label="codex-1"
codex2_label="codex-2"
claude_config_dir=""
zellij_config_dir=""
recreate=false
while [[ $# -gt 0 ]]; do
@@ -90,6 +94,10 @@ while [[ $# -gt 0 ]]; do
claude_config_dir="$2"
shift 2
;;
--zellij-config-dir)
zellij_config_dir="$2"
shift 2
;;
--recreate)
recreate=true
shift
@@ -156,14 +164,22 @@ rm -f "$bootstrap_file"
bootstrap_path="$(kdl_escape "$script_dir/zellij-ai-bootstrap.sh")"
cat >"$layout_file" <<EOF
layout {
pane size=1 borderless=true {
plugin location="tab-bar"
}
pane command="$bootstrap_path"
pane size=2 borderless=true {
plugin location="status-bar"
tab name="AI Triple" {
pane size=1 borderless=true {
plugin location="tab-bar"
}
pane command="$bootstrap_path"
pane size=2 borderless=true {
plugin location="status-bar"
}
}
}
EOF
exec zellij --new-session-with-layout "$layout_file" --session "$session"
if [[ -z "$zellij_config_dir" ]]; then
zellij_config_dir="$(mktemp -d "${TMPDIR:-/tmp}/zellij-ai-triple-${session}.XXXXXX")"
else
mkdir -p "$zellij_config_dir"
fi
exec zellij --config-dir "$zellij_config_dir" --new-session-with-layout "$layout_file" --session "$session"