Expand description
Cross-platform clipboard library with rich types, async support, and context-aware backend selection (native desktop, OSC 52 over SSH / tmux).
§Quick start
use hjkl_clipboard::{Clipboard, Selection, MimeType};
let cb = Clipboard::new().unwrap();
cb.set(Selection::Clipboard, MimeType::Text, b"hello").unwrap();
let data = cb.get(Selection::Clipboard, MimeType::Text).unwrap();
assert_eq!(data, b"hello");§Custom backends
Clipboard::with_backend accepts any Box<dyn Backend>, enabling test
mocks (backend::mock::MockBackend), decorators
(backend::ssh_aware::SshAwareBackend), or third-party impls. Check
Clipboard::capabilities before invoking methods that may return
ClipboardError::UnsupportedMime or ClipboardError::UnsupportedAsync.
Re-exports§
pub use backend::Backend;pub use capabilities::BackendKind;pub use capabilities::Capabilities;pub use error::ClipboardError;pub use mime::MimeType;pub use selection::Selection;pub use uri::Uri;
Modules§
- backend
- Backend trait and platform probe.
- capabilities
BackendKind+Capabilities— runtime introspection of the active clipboard backend.- error
ClipboardError— the single error type for this crate.- mime
MimeType— clipboard content type discriminant.- selection
Selection— clipboard vs primary selection discriminant.- uri
Uri— typed URI for clipboard uri-list operations.
Structs§
- Clipboard
- A handle to the system clipboard.