Make Clipboard the default backend on Linux. Partial fix for #76

This commit is contained in:
Federico Terzi 2019-10-10 19:19:26 +02:00
parent 6ef8ec0cdb
commit ebc4cacd27
3 changed files with 21 additions and 0 deletions

View File

@ -54,6 +54,12 @@ impl super::ClipboardManager for LinuxClipboardManager {
if let Err(e) = res { if let Err(e) = res {
error!("Could not set clipboard: {}", e); error!("Could not set clipboard: {}", e);
} }
let res = child.wait();
if let Err(e) = res {
error!("Could not set clipboard: {}", e);
}
} }
} }
} }

View File

@ -148,9 +148,22 @@ pub enum BackendType {
Clipboard Clipboard
} }
impl Default for BackendType { 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 { fn default() -> Self {
BackendType::Inject BackendType::Inject
} }
#[cfg(target_os = "linux")]
fn default() -> Self {
BackendType::Clipboard
}
} }
impl Configs { impl Configs {

View File

@ -291,6 +291,8 @@ fn daemon_main(config_set: ConfigSet) {
log_panics::init(); log_panics::init();
info!("espanso version {}", VERSION); 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..."); info!("starting daemon...");
let (send_channel, receive_channel) = mpsc::channel(); let (send_channel, receive_channel) = mpsc::channel();