Add zellij backend (real right-split + fork) - #2
Open
ultranity wants to merge 2 commits into
Open
Conversation
Detect $ZELLIJ (like $TMUX) and open the fork via `zellij run -d right -c -n <name> --cwd <pwd> -- claude --continue --fork-session --name <name>`, slotted between the tmux and iTerm2 backends. -c (--close-on-exit) closes the pane when claude exits, so Ctrl-D doesn't leave zellij's "press Enter to re-run / Ctrl-c to kill" prompt behind. Update README terminal tables (zh + en), "how it works", and the --help / --dry-run output to mention zellij / $ZELLIJ. ~.O
- zellij: run the shared $cmd via `zsh -ic` so rc-installed PATH/alias
resolve; --near-current-pane anchors the split to the invoking pane;
hold the pane open on startup failure (with -c alone errors vanished
with the closing pane); swallow the pane-id stdout
- resume: trust CLAUDE_CODE_SESSION_ID only when its transcript lives in
this project's dir and was written in the last 10 min — long-lived
processes born from a Claude Bash call inherit a stale id; otherwise
fall back to --continue with a stderr notice
- one $cmd assembly for all four backends (kills ${=resume} and the
per-backend cwd/quoting variants; dry-run now prints the real thing);
${(qq)} single-quoting keeps `!` inert under interactive histexpand
- check $ZELLIJ before $TMUX: zellij panes inherit the outer server's
$TMUX when nested
- reject dash-leading names (typo'd options) with a clear error
- --record: skip inside zellij — every pane shares the server's
ITERM_SESSION_ID, so mappings would overwrite each other
- README / HOTKEY-FORK / header: document resume-by-id inside a session
vs --continue from a plain terminal
~.O
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a zellij backend to
branchnew, slotted between the tmux and iTerm2 backends.When run inside a zellij session (
$ZELLIJset), it splits a new pane to the right and runs the forked Claude session there:-d right— real right split, matching the tmux backend's semantics.-c/--close-on-exit— close the pane when Claude exits (Ctrl-D), instead of leaving zellij's "press Enter to re-run / Ctrl-c to kill" prompt behind.-n <name>— name the pane after the branch, so the fork is identifiable in zellij's UI (zellij's equivalent of the terminal title the other backends rely on).Backend priority is now: tmux > zellij > iTerm2 > Apple Terminal > new window.
Why
zellij is a tmux-class multiplexer. Previously, users inside zellij fell through to the
$TERM_PROGRAMpath and got a new window instead of an in-place split.Docs
--help/--dry-runnow mention$ZELLIJ.Tested
zellij 0.44.3 on macOS —
zsh -nclean;BRANCHNEW_DRYRUN=1reportsZELLIJ=set; runningbranchnewinside a zellij session splits a pane to the right and forks the session into it.-cis the documented zellij flag for closing the pane on command exit.