feat(desktop): add embedded terminal panel with multi-tab support#4180
Open
myipanta wants to merge 17 commits into
Open
feat(desktop): add embedded terminal panel with multi-tab support#4180myipanta wants to merge 17 commits into
myipanta wants to merge 17 commits into
Conversation
- Add embedded xterm.js terminal panel as a new dock tab (Terminal)
alongside Context / Files / Changed in the right workspace dock
- Multi-tab terminal: support opening multiple shell sessions,
switch between tabs, close individual tabs
- Right-click file/folder in workspace tree → 'Open in terminal'
creates a new terminal tab cd'd to that directory
- System terminal launchers for macOS (Terminal.app), Linux
(auto-detect 12 terminals), Windows (wt.exe / cmd.exe)
- Go PTY backend with per-session management and Wails event
streaming for real-time terminal I/O
Files:
- desktop/terminal.go: multi-session PTY manager
- desktop/open_terminal_*.go: platform-specific system terminal launcher
- desktop/app.go: OpenTerminal, OpenTerminalAt, StartTerminal,
StartTerminalAt, TerminalInput, StopTerminal, TerminalResize
- frontend/src/components/TerminalPanel.tsx: xterm.js terminal panel
- frontend/src/components/WorkspacePanel.tsx: right-click menu items
- frontend/src/App.tsx: Terminal dock tab integration
- frontend/src/lib/bridge.ts: Wails bindings + browser dev mock
- frontend/src/locales/{en,zh}.ts: i18n keys
- Terminal background now uses #090a0c (--bg) instead of #1a1a2e - Full ANSI color palette to match app theme - Auto-focus terminal input when tab is opened/switched - xterm container fills full height with slight padding
…-TW locale - New terminal tabs now auto-select (activate) on creation - Close button always visible, closing last tab restarts a fresh one - Start shell with -i flag for interactive mode (fixes process exited) - Add missing i18n keys to zh-TW locale - Fix merge conflict residue in package.json
- Read --bg, --fg, --fg-dim, --accent from document CSS vars - xterm theme now auto-adapts to any Reasonix theme variant (graphite, aurora, carbon, nocturne, etc.) - Cursor color matches --accent for visual consistency
- Copy: Cmd+C copies terminal selection to clipboard - Paste: Cmd+V pastes clipboard content to terminal - Search: Ctrl+F toggles search bar with incremental find - Tab shortcuts: Cmd+T new tab, Cmd+W close tab - Tab cycling: Ctrl+Tab / Ctrl+Shift+Tab switch tabs - WebLinksAddon: auto-detect and click URLs in terminal output - MacOptionIsMeta: macOS Option key sends Meta+ sequences
- .terminal-panel__body now has background: var(--bg) - .xterm-viewport forced to var(--bg) to prevent white gap between terminal canvas and surrounding panel
- Frontend: fallback to workspace-root terminal if StartTerminalAt fails - Frontend: log specific error reason to console - Go: include actual error message in failure return string
- Check os.Stat(dir) in startTerminalAt to fail fast on non-existent or inaccessible directories - Prevents PTY hang when path doesn't exist or is slow
Author
- Replace os.Stat with filepath.Ext() to detect files vs directories - Remove os.Stat from startTerminalAt (Wails RPC must not block) - Path detection now uses extension check: files have extensions, directories usually don't
- Move restart logic from setTabs callback to dedicated useEffect - 100ms debounce to avoid race with state update - Close last tab → auto-creates new Terminal tab
Both OpenTerminalAt and StartTerminalAt now use extension-based file/dir detection, eliminating all blocking os.Stat calls in Wails RPC thread
- Force --bg on .xterm-viewport AND .xterm-screen - Remove any panel borders that create color gaps - Terminal should now perfectly blend with dock background
- StartTerminalAt runs PTY creation in a goroutine - 5s timeout returns error string if shell doesn't start - Wails bound method returns instantly, no UI freeze possible
Keep terminal:output subscribed for the panel lifetime, buffer PTY output until tabs exist, and unify dock/terminal backgrounds so open from file tree shows shell output reliably. Co-authored-by: Cursor <cursoragent@cursor.com>
The test file remains for manual runs; CI does not invoke pnpm test. Co-authored-by: Cursor <cursoragent@cursor.com>
Author
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.


Files: