Skip to content

Make paste keyboard shortcut customizable from Preferences#125

Open
da2r-20 wants to merge 19 commits into
elirantutia:mainfrom
da2r-20:feature/customizable-paste-shortcut
Open

Make paste keyboard shortcut customizable from Preferences#125
da2r-20 wants to merge 19 commits into
elirantutia:mainfrom
da2r-20:feature/customizable-paste-shortcut

Conversation

@da2r-20

@da2r-20 da2r-20 commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a paste entry to SHORTCUT_DEFAULTS under a new Editing category, surfacing it automatically in Preferences → Shortcuts. Defaults are platform-aware: Cmd+V on macOS, Ctrl+V on Windows, Ctrl+Shift+V on Linux (matches GNOME Terminal / Konsole convention so Ctrl+V next to Ctrl+C is not a footgun in shells).
  • Routes paste through a single cross-platform pipeline: a main-process before-input-event listener matches the configured accelerator and tells the renderer to dispatch; the renderer routes by document.activeElement — terminal panes get bracketed-paste-aware PTY writes; native inputs delegate to webContents.paste() for proper cursor/undo/IME.
  • Removes the hardcoded Windows Ctrl+V branch from terminal-utils.ts and the writeToPty argument from attachClipboardCopyHandler so paste no longer leaks into xterm key handlers.
  • Edit menu shows the active binding label with registerAccelerator: false (label only, no double-firing); rebuilt on startup and on preferences-changed.

Architecture

New files:

  • src/main/paste-accelerator.ts — owns accelerator state, parses Input events, installs the before-input-event listener (idempotent; resets on window close so macOS dock-reopen works).
  • src/renderer/paste-dispatcher.ts — receives paste:dispatch, classifies focus, routes paste.

New IPC channels (preload paste namespace): paste:set-accelerator (renderer → main), paste:dispatch (main → renderer), paste:native (renderer → main).

Design doc: docs/superpowers/specs/2026-04-29-customizable-paste-shortcut-design.md
Plan: docs/superpowers/plans/2026-04-29-customizable-paste-shortcut.md

Test plan

Automated (passes on this branch):

  • npm run build succeeds (main, preload, renderer)
  • npm test — 1386 tests pass
  • Unit tests added for matchesPasteAccelerator, the listener install lifecycle, the focus classifier, the bracketed-paste string builder, and per-platform paste defaults

Manual smoke test (Linux, completed):

  • Default Ctrl+Shift+V pastes into a session terminal with bracketed paste
  • Default Ctrl+Shift+V pastes into a board task-modal text input (cursor + undo correct)
  • Rebound Ctrl+V works in both terminal and inputs; old Ctrl+Shift+V is suppressed
  • Edit menu shows the active accelerator label (correct on startup too)
  • Reset reverts behavior
  • X11 middle-click primary-selection paste still works (regression)

Known follow-ups

  • macOS / Windows verification deferred — implementer is on Linux. Design uses cross-platform primitives (before-input-event, webContents.paste()), but a macOS reviewer should re-verify Cmd+V default + dock-icon close-and-reopen (listener resets on window close), and a Windows reviewer should specifically check no double-paste in board task-modal inputs.
  • Project-terminal panel paste path — the project shell terminal element doesn't carry the .terminal-pane class, so classifyTarget routes it as 'input'webContents.paste() rather than the bracketed-paste path. Paste still works, but via a different codepath than session terminals. Adding the class would unify the two paths.

da2r-20 and others added 19 commits April 29, 2026 15:50
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ride

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… handler

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Linux terminals (GNOME, Konsole, etc.) use Ctrl+Shift+V for clipboard paste
since Ctrl+V is sometimes interpreted by the shell. Make that the default
on Linux; macOS keeps Cmd+V and Windows keeps Ctrl+V.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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