arboard
Cross-platform clipboard access for Rust — copy and paste text, HTML, and images on Linux, macOS, and Windows.
Repository Health
Technical Analysis
Arboard (Arthur’s Clipboard) is a cross-platform Rust library for reading from and writing to the operating system clipboard. It exposes a single, unified Clipboard type that abstracts over the very different clipboard models of Linux (X11 and Wayland), macOS, and Windows, letting you copy and paste plain text, HTML, and raw image data without writing platform-specific code.
Maintained by 1Password, arboard began as a fork of rust-clipboard and has since diverged into its own mature backends and public API. It handles the thorny platform details — Linux selection ownership, Windows single-thread clipboard access, and macOS pasteboard semantics — behind a small, ergonomic surface, with optional features for image support and native Wayland data-control protocols.
What You Get
- A unified
Clipboardtype that works identically on Linux, macOS, and Windows - Text, HTML, and image (RGBA pixel) read/write support via
get_text,set_text,set_html,get_image, andset_image - Platform extension traits for fine-grained control (Linux clipboard selections, Wayland
wait, Windows and Apple set behaviors) - Optional Wayland
data-controlbackend and toggleable image-data support through Cargo features - A typed
Errorenum that distinguishes empty clipboards, occupied clipboards, and unsupported configurations
Common Use Cases
- Adding copy/paste functionality to a Rust GUI or TUI application
- Reading text or images off the clipboard in a CLI tool or automation script
- Programmatically placing HTML with a plain-text fallback onto the clipboard
- Building cross-platform desktop apps that need consistent clipboard behavior on Linux, macOS, and Windows
Under The Hood
Architecture - The public surface lives in src/lib.rs, where a single Clipboard struct wraps a platform::Clipboard selected at compile time. src/platform/mod.rs conditionally re-exports one backend per target: windows.rs (Windows), osx.rs (macOS via objc2 AppKit NSPasteboard), and linux/ (X11 in x11.rs, Wayland in wayland.rs, dispatched through mod.rs). Operations flow through a builder-style get()/set() pair whose .text(), .html(), and .image() methods delegate to the active backend, while shared types like Error and ImageData are defined in src/common.rs.
Tech Stack - Written in Rust (edition 2021, MSRV 1.71). Platform backends pull in x11rb and optional wl-clipboard-rs plus parking_lot/percent-encoding on Linux, windows-sys and clipboard-win on Windows, and the objc2 family (objc2-foundation, objc2-app-kit, objc2-core-graphics) on macOS. Image support is gated behind the image-data feature backed by the image crate; log provides diagnostics. Dependencies are scoped per-target via [target.'cfg(...)'] tables to keep builds lean.
Code Quality - The codebase carries inline #[test] modules in lib.rs, platform/windows.rs, and platform/linux/mod.rs and enables #![warn(unreachable_pub)]. Error handling is explicit through a #[non_exhaustive] Error enum with Display/Debug impls, and the doc comments are unusually thorough about platform pitfalls such as Linux selection ownership and Windows single-thread constraints. Public methods document their error conditions individually.
API Design - The API is small and discoverable: Clipboard::new() plus get_text/set_text/set_html/get_image/set_image cover the common path, so a working copy/paste takes only a few lines (as shown in the README example and examples/hello_world.rs). Platform-specific behavior is layered in through extension traits (SetExtLinux, GetExtLinux, SetExtWindows, SetExtApple) that keep the core cross-platform API clean while still exposing escape hatches, and generic Into<Cow<str>> bounds make the setters ergonomic.
Used by 3 apps in this directory
GitButler
Developer Tools · Devops · AI Development
Git, but better — a modern version control client with stacked branches, parallel workflows, unlimited undo, and first-class support for AI-powered development.
mesh-llm
AI Development · AI Agents
Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.
Vibe Kanban
AI Agents · AI Code Assistants · Project Management
A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.