feat(desktop): copy and paste in the GUI terminal - #73705
Merged
Conversation
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.
Contributor
૮ >ﻌ< ა ci reviewran on 807dc0c ℹ️ InfoDesktop E2E visual evidence · View test artifacts · View job1 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) |
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
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.
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 reasonmain.tsleaves ⌘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.
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:readClipboardIPC 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.