Skip to content

feat(desktop): copy and paste in the GUI terminal - #73705

Merged
OutThisLife merged 1 commit into
mainfrom
bb/terminal-clipboard
Jul 29, 2026
Merged

feat(desktop): copy and paste in the GUI terminal#73705
OutThisLife merged 1 commit into
mainfrom
bb/terminal-clipboard

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Copy and paste work in the GUI terminal now, on every path a person would try: the chord, the Edit menu, and the right-click menu.

xterm paints to a canvas, so its selection is not a DOM selection. webContents.copy() — what Edit ▸ Copy and the right-click Copy item both call — found nothing and copied nothing, and on macOS the app menu swallowed the ⌘C accelerator before the renderer ever saw it (the same reason main.ts leaves ⌘W off the Close item). That left Ctrl+C as the only key that did anything, and xterm correctly forwards it to the PTY as SIGINT — so trying to copy killed the process.

Two mechanisms, because the two failure modes are different. The selection is mirrored into xterm’s hidden helper textarea, which is how the OS learns there is a selection to copy — xterm already does exactly this for Linux middle-click paste. On top of that, explicit chords the terminal handles itself.

Chord macOS Elsewhere
Copy selection ⌘C Ctrl+Shift+C
Paste ⌘V Ctrl+Shift+V
Ctrl+C, text selected (SIGINT — ⌘C is the copy chord) copy + clear selection
Ctrl+C, nothing selected SIGINT SIGINT

The chord table follows VS Code’s terminal.clipboard.contribution.ts. The Ctrl+C row is the “intelligent Ctrl-C” that Windows Terminal and Tabby ship: it copies only when there is a selection to copy, so a running process is never interrupted by a keystroke that meant to copy, and copying never eats the interrupt.

Clipboard reads go through a new hermes:readClipboard IPC handler for the same reason writes already do — the renderer’s clipboard API throws “Document is not focused” whenever a portaled overlay holds focus.

The agent process terminal gets copy but not paste; it has no PTY to paste into. Both chords appear in the keybinds panel as read-only rows, and the key map is a pure function covered by tests.

xterm paints to a canvas, so its selection is not a DOM selection: the Edit
menu's Copy and the right-click Copy both call webContents.copy(), find
nothing, and copy nothing. On macOS the menu also swallows the Cmd+C
accelerator before the renderer sees it. That left Ctrl+C as the only key that
did anything, and xterm correctly forwards it to the PTY as SIGINT.

Mirror the selection into xterm's hidden helper textarea (the mechanism xterm
already uses for Linux middle-click paste) so the OS sees a real selection and
every platform copy path works, and add explicit chords on top: Cmd+C/Cmd+V on
macOS, Ctrl+Shift+C/V elsewhere, matching VS Code. Plain Ctrl+C copies only
when text is selected -- the behavior Windows Terminal and Tabby ship -- and
stays SIGINT otherwise, so interrupting a process never breaks.

Reads go through a new hermes:readClipboard IPC handler for the same reason
writes already do: the renderer's clipboard API throws whenever the document
isn't focused.
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 807dc0c

ℹ️ Info

Desktop E2E visual evidence · View test artifacts · View job

1 visual diff.

inline evidence upload failed.

Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso)

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Jul 29, 2026
@OutThisLife
OutThisLife merged commit 392f1b9 into main Jul 29, 2026
36 checks passed
@OutThisLife
OutThisLife deleted the bb/terminal-clipboard branch July 29, 2026 00:58
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…lipboard

feat(desktop): copy and paste in the GUI terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants