8 releases (4 breaking)
0.5.2 | Apr 19, 2024 |
---|---|
0.4.2 | Apr 13, 2024 |
0.3.1 | Apr 13, 2024 |
0.2.1 | Apr 7, 2024 |
0.1.0 | Apr 7, 2024 |
#436 in Unix APIs
Used in 3 crates
(via termrs_core)
13KB
273 lines
Copyrs
Copyrs — is a tiny rust library, which provides crossplatform API for system clipboard.
It provides implementation for:
- Windows
- Linux
- X11
- Wayland
IOSMacosAndroid
Please note that the library does not currently support:
- Linux's "primary" clipboard.
- Formats other than text (however it can be easily solved).
Example
use copyrs::{clipboard, Clipboard, ClipboardContentKind};
fn main() {
let mut clipboard = clipboard().unwrap();
let content = std::borrow::Cow::Borrowed("Hello, world!".as_bytes());
clipboard
.set_content(content, ClipboardContentKind::Text)
.unwrap();
let content = clipboard.get_content().unwrap();
println!("{0}", content);
}
License
The code is distributed under the MIT License, allowing for flexible usage and modification. Feel free to contribute to the project to improve its functionality and reliability across different platforms. Your contributions are valuable in making Copyrs a robust solution for handling clipboard operations in Rust.
Dependencies
~0–11MB
~123K SLoC