Skip to content

fix: let the Linux app copy to the clipboard - #57

Merged
patrickiel merged 1 commit into
mainfrom
issue-55-copy-diagnostics-linux
Nov 10, 2026
Merged

patrickiel merged 1 commit into
mainfrom
issue-55-copy-diagnostics-linux

Conversation

@patrickiel

Copy link
Copy Markdown
Owner

What

Info → Diagnostics → Copy (and the Report a bug fallback for an over-long report) failed on Linux with "Copy failed".

Why

Instrumented in the running Debug app, navigator.clipboard.writeText threw NotAllowedError with isSecureContext true, document.hasFocus() true, but navigator.userActivation.isActive false inside the click handler. WebKit only allows a clipboard write with transient user activation, and a click delivered to the web view inside JUCE's XEmbed window never grants it. A stock WebKitGTK 2.52 window serving the same juce:// scheme copies fine from a (synthesized) click, so the scheme is not the cause, the embedding is.

Change

New JUCE patch cmake/juce-linux-webkit-clipboard.patch (marker PLECTRIFY_WEBKIT_CLIPBOARD): sets webkit_settings_set_javascript_can_access_clipboard (a symbol JUCE already binds but never calls), only for views with native integrations, which is the app's own page. The TONE3000 window shows a third-party site and keeps JUCE's default, so that site still can't read the clipboard. It's registered in CMakeLists.txt PATCH_COMMAND and JUCE_PATCHES in scripts/shared.ts, documented in cmake/JUCE_PATCHES.md, and added to the patch list in AGENTS.md. No UI change.

Verified

  • pnpm app --dist --no-run: UI format/check/test/build and all 15 native CTests pass. pnpm check (root scripts) passes.
  • In the real Linux Debug app: Copy now shows "Copied", and the full 6.4 KB report was on the system clipboard (wl-paste).
  • The patch applies cleanly after the existing stack, and its reverse applies too, which is the already-applied path in ApplyPatch.cmake.
  • Not tested: a Release .deb build.

Closes #55

Every Copy button on Linux reported "Copy failed". WebKit refuses
navigator.clipboard.writeText with NotAllowedError unless the document has
transient user activation, and a click into the web view embedded in JUCE's
XEmbed window never grants it: instrumented in the app, the handler ran with
navigator.userActivation.isActive false on a secure, focused page. A stock
WebKitGTK window on the same juce:// scheme copies fine from a click.

A new JUCE patch, juce-linux-webkit-clipboard, turns on WebKitGTK's
javascript-can-access-clipboard for views with native integrations only, i.e.
the page the app serves itself. The TONE3000 window shows a third-party site
and keeps the default, so that site still cannot read the clipboard.

This also fixes the Report a bug fallback that copies an over-long report.

Closes #55
@patrickiel
patrickiel merged commit ed4baf2 into main Nov 10, 2026
6 of 7 checks passed
@patrickiel
patrickiel deleted the issue-55-copy-diagnostics-linux branch November 10, 2026 20:52
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.

Copy diagnostics fails on Linux

1 participant