Documentation
On this page

Function · Desktop Services

readClipboardText

Reads plain text from the desktop clipboard.

@sharpts/gui · SharpTS 572a2e31be0e

Signature

TypeScript
readClipboardText(): Promise<string>

Returns

Promise<string> — Clipboard text, or an empty string when no text is available.

Remarks

Clipboard access is scheduled through the active desktop window and may require platform permission.

Throws

  • When no desktop window or system clipboard is available, or the platform rejects clipboard access.

Examples

TypeScript
import { readClipboardText } from "@sharpts/gui";

const text = await readClipboardText();
console.log(text);

Source

src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1639 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.