Skip to content

feat: implement Ghostty tab naming with project and worktree names#15

Merged
malaporte merged 2 commits into
mainfrom
better-shell
Apr 8, 2026
Merged

feat: implement Ghostty tab naming with project and worktree names#15
malaporte merged 2 commits into
mainfrom
better-shell

Conversation

@malaporte
Copy link
Copy Markdown
Owner

Summary

This PR consolidates Ghostty tab management by implementing proper tab naming and switching logic in the main "Open in Ghostty" button, eliminating the need for a separate "Open Opencode" button. Tabs now display descriptive names in the format "project-name / worktree-name" (e.g., "node-commons / this-is-the-worktree").

Changes

  • Modified launchGhostty() function to use AppleScript for tab management instead of the simple open command
  • Implemented tab switching logic to reuse existing tabs for the same worktree path
  • Added tab title setting that extracts both project name (parent directory) and worktree name (last path component)
  • Removed dedicated "Open Opencode" button from LaunchButtons component
  • Removed unused imports and state logic related to opencode detection
  • Updated tests to verify AppleScript usage and new naming format

Testing

  • All 62 tests pass (25 test files)
  • Typecheck passes with no errors
  • Tab naming correctly extracts project and worktree names from the path structure

Reviewer Notes

  • The implementation reuses the AppleScript approach previously used only by the opencode launcher, now applied to all Ghostty launches
  • Tab switching logic checks for existing tabs with matching working directory and reuses them, preventing duplicate tabs
  • The tab title format "project-name / worktree-name" provides better context for users managing multiple worktrees
  • No breaking changes; existing functionality is preserved with enhanced tab management

…ove dedicated Open Opencode button

- Modified launchGhostty function to use AppleScript for tab management and naming
- Implemented tab switching logic to reuse existing tabs for same worktree path
- Added tab title setting using worktree directory name
- Removed dedicated Open Opencode button from LaunchButtons component
- Updated test to verify AppleScript usage instead of open command
- Updated tab naming logic to show "project-name / worktree-name" format
- Extract project name from worktree path parent directory
- Maintained existing tab switching and creation behavior
- Updated test to verify new naming format
@malaporte malaporte marked this pull request as ready for review April 8, 2026 10:01
@malaporte malaporte merged commit 666b5a4 into main Apr 8, 2026
2 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

🎉 This PR is included in version 2.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant