feat(desktop): auto-update tab title from terminal#495
Conversation
Listen for terminal title changes (OSC 0, 1, 2 escape sequences) and automatically update the tab title. Also updates the workspace name if it hasn't been customized (still using the default branch name). This allows shells and programs (vim, htop, ssh, etc.) that set the terminal title to have that reflected in the UI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds an xterm Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant xterm
participant Terminal Component
participant Tab Store
User->>xterm: Change terminal title
xterm->>Terminal Component: Emit onTitleChange event
Terminal Component->>Terminal Component: Debounce the update
Terminal Component->>Tab Store: Call debouncedSetTabAutoTitleRef(title)
Tab Store->>Tab Store: Update tab auto title
Note over Terminal Component: On unmount
Terminal Component->>Terminal Component: Dispose title listener
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (9)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/{components,features}/**/[!.]*.tsx📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/{components,features}/**/*.{ts,tsx,test.ts,test.tsx,stories.tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/desktop/src/renderer/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/desktop/src/{main,renderer,preload}/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{tsx,css}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/{components,features}/**/*.tsx📄 CodeRabbit inference engine (AGENTS.md)
Files:
apps/desktop/**/*.{ts,tsx}📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2025-12-18T23:19:10.415ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Added useSetWorkspaceAutoName hook that invalidates workspace queries after successfully updating the workspace name. This ensures the WorkspaceItem in the top bar reflects the updated name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove the branch-name check that was preventing subsequent auto-updates. Now the workspace name always reflects the terminal title. Only skip update if the name hasn't actually changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…itle The tab and workspace name systems work differently: - Tab name: Zustand store (immediate local updates) - Workspace name: Database mutation (requires query invalidation) Keeping only tab title updates from terminal OSC sequences is simpler and more appropriate - tab shows "what's running", workspace shows "what this is for" (branch name). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
This allows shells and programs (vim, htop, ssh, etc.) that set the terminal title via escape sequences to have that reflected in the UI.
Test plan
echo -e "\033]0;My Custom Title\007")🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.