Skip to content

Add terminal copy/paste and right-click context menu - #9

Merged
coneilen merged 1 commit into
mainfrom
feature/terminal-copy-paste-context-menu
Feb 6, 2026
Merged

coneilen merged 1 commit into
mainfrom
feature/terminal-copy-paste-context-menu

Conversation

@coneilen

@coneilen coneilen commented Feb 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Expose Electron clipboard API (writeText/readText) via the preload bridge so the renderer can access the system clipboard
  • Add keyboard shortcuts in xterm.js custom key handler: Ctrl+Shift+C (copy selection), Ctrl+Shift+V (paste), Ctrl+Shift+A (select all)
  • Introduce TerminalContextMenu.svelte — a positioned dropdown on right-click with Copy, Paste, Select All, and Clear Terminal actions
  • Wire the context menu into Terminal.svelte with proper open/close lifecycle (Escape, click outside, item click)
  • Copy is disabled (greyed out) when no text is selected

Files changed

File Change
src/preload/index.ts Import clipboard from electron, add clipboard to Api interface and implementation
src/renderer/env.d.ts Add clipboard types to renderer Api interface
src/renderer/lib/utils/terminal.ts Add Ctrl+Shift+C/V/A keyboard shortcuts
src/renderer/lib/components/TerminalContextMenu.svelte New — context menu component
src/renderer/lib/components/Terminal.svelte Wire context menu, handle actions

Test plan

  • Mouse-select text in terminal → highlighted with selection colors
  • Ctrl+Shift+C copies selected text to system clipboard
  • Ctrl+Shift+V pastes system clipboard into terminal session
  • Ctrl+Shift+A selects all terminal content
  • Right-click opens context menu at cursor position
  • Context menu Copy/Paste/Select All/Clear all function correctly
  • Context menu closes on Escape, click outside, or any item click
  • Copy item is greyed out and disabled when no text is selected
  • Menu repositions when it would overflow the viewport

🤖 Generated with Claude Code

Expose Electron clipboard API via preload bridge and add keyboard shortcuts
(Ctrl+Shift+C/V/A) for copy, paste, and select-all in terminal sessions.
Introduce a new TerminalContextMenu component with Copy, Paste, Select All,
and Clear Terminal actions triggered by right-click.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coneilen
coneilen merged commit 08ecd26 into main Feb 6, 2026
3 checks passed
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