feat(terminal-launch): spawn new sessions into tmux pane when in TMUX (#74)#193
Open
quangdang46 wants to merge 1 commit into
Open
feat(terminal-launch): spawn new sessions into tmux pane when in TMUX (#74)#193quangdang46 wants to merge 1 commit into
quangdang46 wants to merge 1 commit into
Conversation
When jcode is launched from inside an attached tmux session, every
"open in new terminal" path (resume picker, /split, /selfdev, list_sessions)
previously launched an entirely new terminal emulator. That blew the
user out of tmux and lost the session/window grouping.
Detect TMUX via the $TMUX env var (tmux always sets this for processes
inside an attached pane) and add a tmux dispatch arm in
build_spawn_command:
tmux split-window -d -c <cwd> '<shell>' \; select-layout tiled
`-d` keeps focus on the originating pane; `select-layout tiled` re-flows
so the new pane is visible. Add "tmux" to resume_terminal_candidates
ahead of the GUI emulators on both Linux and macOS so it wins
naturally when present.
Test `detected_resume_terminal_recognizes_tmux_via_tmux_env` covers
detection priority.
Ports upstream PR 1jehuang#78. Local
fork's spawn dispatch lives in `crates/jcode-terminal-launch` rather
than `src/cli/tui_launch.rs` (upstream's layout), so the tmux match
arm is added there and reused by all callers automatically.
Closes #74
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
When jcode is launched from inside an attached tmux session, every "open in new terminal" path (resume picker, /split, /selfdev, list_sessions) previously launched an entirely new terminal emulator. That blew the user out of tmux and lost the session/window grouping.
This addresses issue #74: #74
Changes
detected_resume_terminal(unix branch) now returns"tmux"when$TMUXis set (tmux always sets this for processes inside an attached pane). Inserted ahead ofKITTY_PID/WEZTERM_*checks so tmux wins over an outer GUI emulator.resume_terminal_candidateslists for both Linux and macOS, ahead of the GUI emulators.tmuxarm inbuild_spawn_commandthat runs:-dkeeps focus on the originating pane;select-layout tiledre-flows so the new pane is visible.detected_resume_terminal_recognizes_tmux_via_tmux_envcovers detection priority.Tests
Notes / scope deviation from upstream
Upstream PR 1jehuang#78 puts the dispatch in
src/cli/tui_launch.rsnext to the--standaloneflag handling. This fork extracted spawn dispatch intocrates/jcode-terminal-launch(and removed--standaloneper #102), so the tmux match arm is added there and reused by all callers automatically.