copycat

A cross-platform clipboard CLI and library written in Zig. Reads and writes arbitrary clipboard formats by their native identifier --- UTI on macOS, MIME type on Linux, format ID on Windows --- not just text and images.

$ copycat
Clipboard contents (3 formats, changeCount: 142):

  public.utf8-plain-text    28 bytes
  "Hello, world! This is a test"

  public.html               1204 bytes
  "<div style=\"font-family:sans-serif\">Hello..."

  public.png                24381 bytes
  [89 50 4E 47 0D 0A 1A 0A] ... (PNG image)

Most clipboard tools expose a fixed set of types. The system clipboard is actually a generic key-value store: applications routinely put a dozen representations of the same data on it. copycat treats the clipboard as what it is --- a map from format identifiers to raw bytes --- and lets you list, read, and write them directly.

Supports OSC 52 for copying to your local clipboard over SSH --- no X forwarding needed.

Also builds as a C ABI shared library, loadable via FFI from Bun, Node, Python, Rust, or anything else that can call a .dylib / .so / .dll.

brew install georgemandis/tap/copycat

Read More