diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-06-09 11:46:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-09 11:46:31 +0000 |
commit | bc2c34eb7f9eea251822d94ea534a1d2de03c5a1 (patch) | |
tree | 8aebbcb1f31dac6f9439f71e784605ca1133ea35 /copypasta/examples/primary_selection.rs | |
parent | 4cd55acd7820a7358f9175c106c91e0945fb15b2 (diff) | |
download | r-alacritty-bc2c34eb7f9eea251822d94ea534a1d2de03c5a1.tar.gz r-alacritty-bc2c34eb7f9eea251822d94ea534a1d2de03c5a1.tar.bz2 r-alacritty-bc2c34eb7f9eea251822d94ea534a1d2de03c5a1.zip |
Add wayland primary selection clipboard support
Diffstat (limited to 'copypasta/examples/primary_selection.rs')
-rw-r--r-- | copypasta/examples/primary_selection.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/copypasta/examples/primary_selection.rs b/copypasta/examples/primary_selection.rs new file mode 100644 index 00000000..5525935e --- /dev/null +++ b/copypasta/examples/primary_selection.rs @@ -0,0 +1,19 @@ +extern crate copypasta; + +#[cfg(target_os = "linux")] +use copypasta::x11_clipboard::{Primary, X11ClipboardContext}; +use copypasta::ClipboardProvider; + +#[cfg(target_os = "linux")] +fn main() { + let mut ctx = X11ClipboardContext::<Primary>::new().unwrap(); + + let the_string = "Hello, world!"; + + ctx.set_contents(the_string.to_owned()).unwrap(); +} + +#[cfg(not(target_os = "linux"))] +fn main() { + println!("Primary selection is only available under linux!"); +} |