Vicinae

Clipboard

Read from and write to the system clipboard.

Copy

import { Clipboard } from "@vicinae/api";

await Clipboard.copy("🍎 Apple");

Pass concealed to prevent the entry from being indexed by the clipboard manager (useful for secrets).

await Clipboard.copy("secret-api-key", { concealed: true });

Paste

Paste content into the frontmost application. Falls back to a regular copy if pasting isn't supported.

import { Clipboard } from "@vicinae/api";

await Clipboard.paste("🍎");

Read

Read the current clipboard content. Can contain text, HTML, or a file path.

import { Clipboard } from "@vicinae/api";

const { text } = await Clipboard.read();

Or read just the text:

const text = await Clipboard.readText();

Clear

import { Clipboard } from "@vicinae/api";

await Clipboard.clear();

Content Types

Clipboard.copy and Clipboard.paste accept a string or a Clipboard.Content object:

await Clipboard.copy({ html: "<b>Apple</b>", text: "Apple" });
await Clipboard.copy({ file: "/path/to/image.png" });