| Crates.io | clipboard-ext |
| lib.rs | clipboard-ext |
| version | 0.2.0 |
| created_at | 2020-02-13 19:04:51.561756+00 |
| updated_at | 2020-02-13 23:15:56.827841+00 |
| description | A clipboard library providing useful extensions for rust-clipboard. |
| homepage | |
| repository | https://gitlab.com/timvisee/rust-clipboard-ext |
| max_upload_size | |
| id | 208069 |
| size | 45,470 |
A clipboard library providing useful extensions for the
rust-clipboard library.
I had a growing annoyance with rust-clipboard, because the clipboard is
cleared on the Linux/X11 platform when your application exists as per X11
design. The crate maintainer didn't want to implement workarounds (for valid
reasons). This clipboard-ext crate provides additional
clipboard contexts that solve this, along with a few other additions.
Here are some of these additions:
X11ForkClipboardProvider:
forks process and sets clipboard, keeps contents after exitX11BinClipboardProvider:
invokes xclip/xsel to set clipboard, keeps contents after exitOsc52ClipboardContext:
use OSC 52 escape sequence to set clipboard contentsCombinedClipboardProvider:
combine two providers, use different for getting/setting clipboardGet and set clipboard contents. Keeps contents in X11 clipboard after exit by
forking the process. Falls back to standard clipboard provider on non X11 platforms.
See x11_fork
module for details.
use clipboard_ext::prelude::*;
use clipboard_ext::x11_fork::ClipboardContext;
fn main() {
let mut ctx = ClipboardContext::new().unwrap();
println!("{:?}", ctx.get_contents());
ctx.set_contents("some string".into()).unwrap();
}
Get and set clipboard contents. Keeps contents in X11 clipboard after exit by
invoking xclip/xsel. Falls back to standard clipboard provider on non X11
platforms. See x11_bin
module for details.
use clipboard_ext::prelude::*;
use clipboard_ext::x11_bin::ClipboardContext;
fn main() {
let mut ctx = ClipboardContext::new().unwrap();
println!("{:?}", ctx.get_contents());
ctx.set_contents("some string".into()).unwrap();
}
rust-clipboardaweinstock314 for building rust-clipboardThis project is dual-licensed under the MIT and Apache2 license.