Repository navigation
fix: let the Linux app copy to the clipboard - #57
Merged
Merged
Conversation
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
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.
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.writeTextthrewNotAllowedErrorwithisSecureContexttrue,document.hasFocus()true, butnavigator.userActivation.isActivefalse 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 samejuce://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(markerPLECTRIFY_WEBKIT_CLIPBOARD): setswebkit_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 inCMakeLists.txtPATCH_COMMANDandJUCE_PATCHESinscripts/shared.ts, documented incmake/JUCE_PATCHES.md, and added to the patch list inAGENTS.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.wl-paste).ApplyPatch.cmake..debbuild.Closes #55