[−][src]Module copypasta_ext::x11_fork
Like x11_clipboard
, but forks to set contents.
This provider ensures the clipboard contents you set remain available even after your
application exists, unlike X11ClipboardContext
.
When setting the clipboard, the process is forked in which the clipboard is set. The fork is kept alive until the clipboard content changes, and may outlive your application.
Use the provided ClipboardContext
type alias to use this clipboard context on supported
platforms, but fall back to the standard clipboard on others.
Benefits
- Keeps contents in clipboard even after your application exists.
Drawbacks
- Set contents may not be immediately available, because they are set in a fork.
- Errors when setting the clipboard contents are not catched, the fork will panic
set_contents
will return no error. - The fork might cause weird behaviour for some applications.
Examples
use copypasta_ext::prelude::*; use copypasta_ext::x11_fork::X11ForkClipboardContext; let mut ctx: X11ForkClipboardContext = X11ForkClipboardContext::new().unwrap(); println!("{:?}", ctx.get_contents()); ctx.set_contents("some string".into()).unwrap();
Use ClipboardContext
alias for better platform compatability:
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();
Structs
X11ForkClipboardContext | Like |
Enums
Error | Represents X11 fork related error. |
Type Definitions
ClipboardContext | Platform specific context. |