Skip to content

fix: explicitly cd to project dir in every non-first pane - #4

Merged
minorole merged 2 commits into
mainfrom
fix/pane-directory-inheritance
Feb 16, 2026
Merged

fix: explicitly cd to project dir in every non-first pane#4
minorole merged 2 commits into
mainfrom
fix/pane-directory-inheritance

Conversation

@minorole

Copy link
Copy Markdown
Owner

Summary

  • Panes created after pane 1 relied on Ghostty's directory inheritance, which breaks when pane 1 runs a foreground process (e.g. claude, npm run dev) — Ghostty can't resolve CWD from a busy shell, so splits start in ~
  • Now every non-first pane gets an explicit cd /project && clear before its command, using a separate paste step (not concatenated) to preserve user commands exactly
  • Applied consistently to both layout-dynamic.applescript and layout-hybrid.applescript

What changed

Phase 2 anchor panes (row 2+ in multi-row layouts):

  • Added cd && clear when spatialIdx > 1 (pane 1 already has cd)

Phase 2 horizontal split panes (all Cmd+D splits):

  • Added cd && clear after every split — always non-first by definition

Timing impact

+0.3s per non-first pane. For a quad layout (4 panes): +0.9s total on ~6s setup.

Test plan

  • ./tests/test-layouts.zsh — 33/33 pass
  • --dry-run unaffected (exits before AppleScript)
  • Manual: gpane <project> with duo layout — verify pane 2 starts in project dir
  • Manual: quad layout — verify all 4 panes start in project dir
  • Manual: tabs+panes hybrid — verify across tabs

Panes created after pane 1 relied on Ghostty's directory inheritance,
which fails when pane 1 runs a foreground process (e.g. claude, npm run
dev). Now every non-first pane gets an explicit cd before its command.
@minorole

Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

…on layer

Prepend cd <dir> to every command in zsh before passing to AppleScript,
making each pane command self-contained. Removes 6 fragile cd-injection
blocks from AppleScript that depended on clipboard timing delays.
@minorole
minorole merged commit 9bb5b36 into main Feb 16, 2026
1 check passed
@minorole
minorole deleted the fix/pane-directory-inheritance branch February 16, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant