Skip to content

feat(desktop): add 'Open in TUI' context menu for sessions#20426

Open
yhl10000 wants to merge 1 commit intoanomalyco:devfrom
yhl10000:feat/open-in-tui
Open

feat(desktop): add 'Open in TUI' context menu for sessions#20426
yhl10000 wants to merge 1 commit intoanomalyco:devfrom
yhl10000:feat/open-in-tui

Conversation

@yhl10000
Copy link
Copy Markdown

@yhl10000 yhl10000 commented Apr 1, 2026

Issue for this PR

N/A — new feature request. No existing issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a right-click context menu on session items in the desktop sidebar. The menu has two actions:

  1. Open in TUI — spawns a system terminal running opencode attach <url> --session <id> --password <pwd>, connecting to the same running sidecar and session so users can continue working in TUI mode.
  2. Archive — archives the session (existing functionality, now accessible via context menu).

The terminal spawning is cross-platform:

  • Windows: cmd /c start cmd /k ... opens a new cmd window
  • macOS: osascript tells Terminal.app to run the command
  • Linux: tries x-terminal-emulator, gnome-terminal, konsole, xterm in order

The implementation follows the existing IPC chain pattern: ElectronAPI type → preload bridge → IPC handler → Platform abstraction → UI. The packages/app layer stays platform-agnostic by using an optional openInTui method on the Platform interface.

How did you verify your code works?

  • Launched the desktop app with npx electron-vite dev
  • Confirmed the sidecar starts and the app reaches done state
  • Reviewed all 6 changed files for type correctness against existing patterns
  • Verified no new type errors introduced (all typecheck failures are pre-existing in packages/opencode/src/provider/sdk/copilot/)

Screenshots / recordings

image

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Add right-click context menu on session items in the sidebar with an
'Open in TUI' option that spawns a system terminal running
\opencode attach\ connected to the same backend server and session.

Implementation spans the full IPC chain:
- ElectronAPI type + preload bridge for \openInTui\
- IPC handler with cross-platform terminal spawning (Windows/macOS/Linux)
- Platform abstraction so the app package stays platform-agnostic
- ContextMenu UI on SessionItem with 'Open in TUI' and 'Archive' actions
@yhl10000 yhl10000 requested a review from adamdotdevin as a code owner April 1, 2026 06:56
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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