2.1 KiB
Legcord Clipboard Fallback Plugin
Fixes Discord in-page copy actions in Legcord, including:
- Copy User ID
- Copy Message ID
- Copy Message Link
- Other Discord menu actions that call
navigator.clipboard.writeText(...)
Why this exists
In affected Legcord/Electron environments, Discord's web UI calls:
navigator.clipboard.writeText(text)
but Chromium rejects it, commonly with errors like:
NotAllowedError: Failed to execute 'writeText' on 'Clipboard': Document is not focused.
or Legcord logs:
Unable to determine render window for element [object HTMLDocument]
This plugin patches navigator.clipboard.writeText in the Discord page and falls back to a selection-based document.execCommand("copy") copy path.
Known limitation
Legcord's native Copy Image context-menu action does not go through navigator.clipboard.writeText or navigator.clipboard.write in the page. It is handled by Electron's main-process context menu (webContents.copyImageAt(...)), so a renderer/custom-bundle plugin cannot reliably fix image copying. That needs a Legcord main-process fix or a filesystem plugin with main/preload access on newer Legcord versions.
Install on Legcord versions with filesystem plugins
-
Open the Legcord plugins folder:
~/Library/Application Support/legcord/plugins -
Create this folder:
clipboard-fallback -
Copy these files into it:
manifest.json renderer.js -
Restart Legcord.
-
Enable Clipboard Fallback in Legcord's plugin settings.
Older Legcord workaround: custom bundle
If your Legcord version does not have filesystem plugins yet, copy custom-bundle.js into:
~/Library/Application Support/legcord/custom.js
Do not use renderer.js as custom.js; renderer.js is the filesystem-plugin entry and expects Legcord's plugin loader to provide module.exports.
and add "custom" to the mods array in:
~/Library/Application Support/legcord/storage/settings.json
Example:
"mods": ["equicord", "custom"]
Then restart Legcord.