Shortcuts and clipboard
Declare shortcuts to register host keyboard shortcuts and clipboard to write text. The clipboard service is write-only and requires a recent host-observed user interaction.
Copy text from a shortcut
Section titled “Copy text from a shortcut”cleanup.push( await api.shortcuts.register("Ctrl+Shift+X", () => { void api.clipboard.writeText("Copied by my plugin").catch(() => { api.logger.warn("Clipboard write failed; activate the shortcut again."); }); }),);Save the returned disposer and release it in stop. Avoid overlapping Fluxer’s existing shortcuts; expose the combination as a plugin setting if users need to change it.
Matching rules
Section titled “Matching rules”Shortcuts match exact modifiers and ignore repeats. Supported names are Ctrl, Shift, Alt, and Meta. Control and Cmd/Command are aliases. A modifier combination must match the actual event; extra modifiers do not count as the same shortcut.
Clipboard restrictions
Section titled “Clipboard restrictions”Writes are limited to 8192 characters and must follow an observed shortcut, inspection click, overlay action, attachment action, or dialog submission.
A sandbox-generated click cannot manufacture host authorization. Do not defer clipboard work behind unrelated long-running operations. If authorization expires or a write fails, ask the user to activate the action again.
There is no clipboard-read API. Do not request broader privileges or use parent-page code to work around that boundary.
