[−][src]Crate copypasta_ext
A clipboard library providing useful extensions for the
copypasta
library.
Here are some of these additions:
X11ForkClipboardProvider
: forks process and sets clipboard, keeps contents after exitX11BinClipboardProvider
: invokesxclip
/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 clipboard
Example
Get 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 copypasta_ext::prelude::*; use copypasta_ext::x11_fork::ClipboardContext; 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 copypasta_ext::prelude::*; use copypasta_ext::x11_bin::ClipboardContext; let mut ctx = ClipboardContext::new().unwrap(); println!("{:?}", ctx.get_contents()); ctx.set_contents("some string".into()).unwrap();
Requirements
- Rust 1.41 or above
- Same requirements as
copypasta
- Requirements noted in specific clipboard context modules
Re-exports
pub use copypasta; |
Modules
osc52 | OSC 52 escape sequence to set clipboard contents. |
prelude | Trait prelude. |
x11_bin | |
x11_fork |
Structs
CombinedClipboardContext | Combined, use different clipboard context for getting & setting. |
Type Definitions
ClipResult | Copypasta error type, for your convenience. |