Expand description
OSC 52 escape sequence to set clipboard contents.
This provider can set clipboard contents by outputting a sequence to stdout in supported terminals. It uses Xterm escape sequences, OSC 52 to be exact.
Getting clipboard contents is not supported through this context and will error.
§Benefits
- Keeps contents in clipboard for the terminal lifetime even after your application exists.
§Drawbacks
- Requires terminal that supports these escape codes.
- Doesn’t catch errors while setting clipboard contents.
- Cannot get clipboard contents.
§Examples
use copypasta_ext::prelude::*;
use copypasta_ext::x11_bin::X11BinClipboardContext;
let mut ctx = X11BinClipboardContext::new().unwrap();
ctx.set_contents("some string".into()).unwrap();Use new_with to combine with another context such as X11ClipboardContext to support getting clipboard contents as well.
use copypasta_ext::prelude::*;
use copypasta_ext::osc52::Osc52ClipboardContext;
use copypasta_ext::x11_bin::X11BinClipboardContext;
let mut ctx = Osc52ClipboardContext::new_with(X11BinClipboardContext::new().unwrap()).unwrap();
println!("{:?}", ctx.get_contents());
ctx.set_contents("some string".into()).unwrap();Structs§
- Osc52
Clipboard Context - OSC 52 escape sequence to set clipboard contents.
Enums§
- Error
- Represents OSC 52 clipboard related error.
Type Aliases§
- Clipboard
Context - Platform specific context.