Skip to content

Fix Ctrl+V paste in standalone — skip macOS WKWebView paste prompt#65

Merged
nedtwigg merged 2 commits into
mainfrom
fix-standalone-paste
May 14, 2026
Merged

Fix Ctrl+V paste in standalone — skip macOS WKWebView paste prompt#65
nedtwigg merged 2 commits into
mainfrom
fix-standalone-paste

Conversation

@nedtwigg
Copy link
Copy Markdown
Member

@nedtwigg nedtwigg commented May 14, 2026

Summary

  • Ctrl+V (and Cmd+V) in the standalone app triggered macOS WKWebView's "Paste from " confirmation menu at the cursor instead of just pasting. Root cause: navigator.clipboard.readText() pops that menu every time it's invoked from JS on WKWebView.
  • Routes clipboard text reads through the sidecar (pbpaste / Get-Clipboard -Raw / xclip / wl-paste), mirroring how files and images are already read natively. The standalone never calls navigator.clipboard.readText() again.
  • Accepts either Ctrl+V or Cmd+V for paste on all platforms (matches VSCode terminal paste and muscle memory from Linux/Windows). Copy stays platform-native to avoid shadowing ^C/SIGINT in shells.
  • Parallelizes the file-paths and text reads in doPaste — they're independent IPC roundtrips and the old file-first ordering was only there to avoid the popup, which the native read now removes.

Test plan

  • On macOS standalone: Ctrl+V pastes text without showing the "Paste from " popup
  • On macOS standalone: Cmd+V pastes text without showing the popup
  • On macOS standalone: Cmd+V of a Finder file still types the shell-escaped path
  • On macOS standalone: Cmd+V of a screenshot still drops to a temp PNG path
  • On VSCode extension: Cmd+V/Ctrl+V text paste behavior unchanged (no native readClipboardText → falls back to the Web API, which Electron handles without a popup)
  • Sidecar tests: node --test standalone/sidecar/clipboard-ops.test.js (6 new tests for mac/win/linux)
  • Lib tests: pnpm --filter mouseterm-lib test (450 passing; updated doPaste fallthrough test for the new parallel ordering)

🤖 Generated with Claude Code

nedtwigg and others added 2 commits May 14, 2026 12:28
…e prompt

navigator.clipboard.readText() pops a "Paste from <App>" confirmation menu
at the cursor on macOS WKWebView every time it's invoked from JS, which
defeats the point of a paste shortcut. Route text reads through the sidecar
(pbpaste / Get-Clipboard / xclip / wl-paste) the same way files and images
already work, and accept either Ctrl+V or Cmd+V so the shortcut matches
user muscle memory on every platform.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Now that the standalone reads clipboard text natively, the file-first
ordering no longer protects against the WKWebView paste prompt and can
run alongside the text read. Image stays sequential since it allocates
a temp file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1bcdc8d
Status: ✅  Deploy successful!
Preview URL: https://3f904c87.mouseterm.pages.dev
Branch Preview URL: https://fix-standalone-paste.mouseterm.pages.dev

View logs

@nedtwigg nedtwigg merged commit 9146b1d into main May 14, 2026
6 checks passed
@nedtwigg nedtwigg deleted the fix-standalone-paste branch May 14, 2026 20:07
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