diff --git a/espanso-config/src/config/mod.rs b/espanso-config/src/config/mod.rs index dd88929..0992372 100644 --- a/espanso-config/src/config/mod.rs +++ b/espanso-config/src/config/mod.rs @@ -150,6 +150,10 @@ pub trait Config: Send + Sync { // If false, avoid showing the SecureInput notification on macOS fn secure_input_notification(&self) -> bool; + // If true, use the `xclip` command to implement the clipboard instead of + // the built-in native module on X11. + fn x11_use_xclip_backend(&self) -> bool; + // If true, filter out keyboard events without an explicit HID device source on Windows. // This is needed to filter out the software-generated events, including // those from espanso, but might need to be disabled when using some software-level keyboards. @@ -193,6 +197,7 @@ pub trait Config: Send + Sync { show_notifications: {:?} secure_input_notification: {:?} + x11_use_xclip_backend: {:?} win32_exclude_orphan_events: {:?} win32_keyboard_layout_cache_interval: {:?} @@ -224,6 +229,7 @@ pub trait Config: Send + Sync { self.show_notifications(), self.secure_input_notification(), + self.x11_use_xclip_backend(), self.win32_exclude_orphan_events(), self.win32_keyboard_layout_cache_interval(), diff --git a/espanso-config/src/config/parse/mod.rs b/espanso-config/src/config/parse/mod.rs index bd39ad4..94f174d 100644 --- a/espanso-config/src/config/parse/mod.rs +++ b/espanso-config/src/config/parse/mod.rs @@ -46,6 +46,7 @@ pub(crate) struct ParsedConfig { pub secure_input_notification: Option, pub win32_exclude_orphan_events: Option, pub win32_keyboard_layout_cache_interval: Option, + pub x11_use_xclip_backend: Option, pub pre_paste_delay: Option, pub restore_clipboard_delay: Option, diff --git a/espanso-config/src/config/parse/yaml.rs b/espanso-config/src/config/parse/yaml.rs index 824429c..d666662 100644 --- a/espanso-config/src/config/parse/yaml.rs +++ b/espanso-config/src/config/parse/yaml.rs @@ -112,6 +112,9 @@ pub(crate) struct YAMLConfig { #[serde(default)] pub win32_keyboard_layout_cache_interval: Option, + #[serde(default)] + pub x11_use_xclip_backend: Option, + // Include/Exclude #[serde(default)] pub includes: Option>, @@ -201,6 +204,7 @@ impl TryFrom for ParsedConfig { win32_exclude_orphan_events: yaml_config.win32_exclude_orphan_events, win32_keyboard_layout_cache_interval: yaml_config.win32_keyboard_layout_cache_interval, + x11_use_xclip_backend: yaml_config.x11_use_xclip_backend, use_standard_includes: yaml_config.use_standard_includes, includes: yaml_config.includes, @@ -258,6 +262,7 @@ mod tests { secure_input_notification: false win32_exclude_orphan_events: false win32_keyboard_layout_cache_interval: 300 + x11_use_xclip_backend: true use_standard_includes: true includes: ["test1"] @@ -311,6 +316,7 @@ mod tests { secure_input_notification: Some(false), win32_exclude_orphan_events: Some(false), win32_keyboard_layout_cache_interval: Some(300), + x11_use_xclip_backend: Some(true), pre_paste_delay: Some(300), evdev_modifier_delay: Some(40), diff --git a/espanso-config/src/config/resolve.rs b/espanso-config/src/config/resolve.rs index afcad9b..8738085 100644 --- a/espanso-config/src/config/resolve.rs +++ b/espanso-config/src/config/resolve.rs @@ -330,6 +330,10 @@ impl Config for ResolvedConfig { .win32_keyboard_layout_cache_interval .unwrap_or(2000) } + + fn x11_use_xclip_backend(&self) -> bool { + self.parsed.x11_use_xclip_backend.unwrap_or(false) + } } impl ResolvedConfig { @@ -413,6 +417,7 @@ impl ResolvedConfig { secure_input_notification, win32_exclude_orphan_events, win32_keyboard_layout_cache_interval, + x11_use_xclip_backend, includes, excludes, extra_includes, diff --git a/espanso-config/src/legacy/mod.rs b/espanso-config/src/legacy/mod.rs index 8347c8e..b67e0f7 100644 --- a/espanso-config/src/legacy/mod.rs +++ b/espanso-config/src/legacy/mod.rs @@ -398,6 +398,10 @@ impl Config for LegacyInteropConfig { fn win32_keyboard_layout_cache_interval(&self) -> i64 { 2000 } + + fn x11_use_xclip_backend(&self) -> bool { + false + } } struct LegacyMatchGroup {