From ebc4cacd270d0b800c2eed612bf21958094e2f48 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Thu, 10 Oct 2019 19:19:26 +0200 Subject: [PATCH] Make Clipboard the default backend on Linux. Partial fix for #76 --- src/clipboard/linux.rs | 6 ++++++ src/config/mod.rs | 13 +++++++++++++ src/main.rs | 2 ++ 3 files changed, 21 insertions(+) diff --git a/src/clipboard/linux.rs b/src/clipboard/linux.rs index a20c2c6..7e14a07 100644 --- a/src/clipboard/linux.rs +++ b/src/clipboard/linux.rs @@ -54,6 +54,12 @@ impl super::ClipboardManager for LinuxClipboardManager { if let Err(e) = res { error!("Could not set clipboard: {}", e); } + + let res = child.wait(); + + if let Err(e) = res { + error!("Could not set clipboard: {}", e); + } } } } diff --git a/src/config/mod.rs b/src/config/mod.rs index ffb5307..a8bf6cc 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -148,9 +148,22 @@ pub enum BackendType { Clipboard } impl Default for BackendType { + // The default backend varies based on the operating system. + // On Windows and macOS, the Inject backend is working great and should + // be preferred as it doesn't override the clipboard. + // On the other hand, on linux it has many problems due to the bugs + // of the libxdo used. For this reason, Clipboard will be the default + // backend on Linux from version v0.3.0 + + #[cfg(not(target_os = "linux"))] fn default() -> Self { BackendType::Inject } + + #[cfg(target_os = "linux")] + fn default() -> Self { + BackendType::Clipboard + } } impl Configs { diff --git a/src/main.rs b/src/main.rs index 1ffb485..8b8da15 100644 --- a/src/main.rs +++ b/src/main.rs @@ -291,6 +291,8 @@ fn daemon_main(config_set: ConfigSet) { log_panics::init(); info!("espanso version {}", VERSION); + info!("using config path: {}", context::get_config_dir().to_string_lossy()); + info!("using package path: {}", context::get_package_dir().to_string_lossy()); info!("starting daemon..."); let (send_channel, receive_channel) = mpsc::channel();