From 9e89aaa477369b20a06f4b9f636d7fd543c4c985 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sun, 28 Apr 2019 20:21:39 +0000 Subject: Switch from copypasta to rust-clipboard This switches our own `copypasta` crate with the more standardized `clipboard` library, which allows us to get rid of the `xclip` dependency on X11. Additionally, this lays the foundation for native Wayland clipboard support once the clipboard crate is updated (or a fork is created). Fixes #5. --- alacritty/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'alacritty/src') diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs index 7a200a8b..be512bee 100644 --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -41,6 +41,7 @@ use std::env; #[cfg(not(windows))] use std::os::unix::io::AsRawFd; +use alacritty_terminal::clipboard::Clipboard; use alacritty_terminal::config::{self, Config, Monitor}; use alacritty_terminal::display::Display; use alacritty_terminal::event_loop::{self, EventLoop, Msg}; @@ -138,12 +139,18 @@ fn run( info!("PTY Dimensions: {:?} x {:?}", display.size().lines(), display.size().cols()); + // Create new native clipboard + #[cfg(not(any(target_os = "macos", target_os = "windows")))] + let clipboard = Clipboard::new(display.get_wayland_display()); + #[cfg(any(target_os = "macos", target_os = "windows"))] + let clipboard = Clipboard::new(); + // Create the terminal // // This object contains all of the state about what's being displayed. It's // wrapped in a clonable mutex since both the I/O loop and display need to // access it. - let terminal = Term::new(&config, display.size().to_owned(), message_buffer); + let terminal = Term::new(&config, display.size().to_owned(), message_buffer, clipboard); let terminal = Arc::new(FairMutex::new(terminal)); // Find the window ID for setting $WINDOWID -- cgit