feat(core): wire up evdev_modifier_delay option
This commit is contained in:
parent
fc96d80791
commit
b5422b939d
|
@ -151,6 +151,7 @@ impl<'a> super::engine::dispatch::executor::InjectParamsProvider for ConfigManag
|
|||
disable_x11_fast_inject: active.disable_x11_fast_inject(),
|
||||
inject_delay: active.inject_delay(),
|
||||
key_delay: active.key_delay(),
|
||||
evdev_modifier_delay: active.evdev_modifier_delay(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ impl<'a> ClipboardInjectorAdapter<'a> {
|
|||
} else {
|
||||
error!("'{}' is not a valid paste shortcut", custom_shortcut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let combination = if let Some(custom_combination) = custom_combination {
|
||||
custom_combination
|
||||
|
@ -89,6 +89,7 @@ impl<'a> ClipboardInjectorAdapter<'a> {
|
|||
InjectionOptions {
|
||||
delay: params.paste_shortcut_event_delay as i32,
|
||||
disable_fast_inject: params.disable_x11_fast_inject,
|
||||
..Default::default()
|
||||
},
|
||||
)?;
|
||||
|
||||
|
|
|
@ -53,10 +53,20 @@ impl<'a> TextInjector for EventInjectorAdapter<'a> {
|
|||
let injection_options = InjectionOptions {
|
||||
delay: params
|
||||
.inject_delay
|
||||
.unwrap_or(InjectionOptions::default().delay.try_into().unwrap())
|
||||
.unwrap_or_else(|| InjectionOptions::default().delay.try_into().unwrap())
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
disable_fast_inject: params.disable_x11_fast_inject,
|
||||
evdev_modifier_delay: params
|
||||
.evdev_modifier_delay
|
||||
.unwrap_or_else(|| {
|
||||
InjectionOptions::default()
|
||||
.evdev_modifier_delay
|
||||
.try_into()
|
||||
.unwrap()
|
||||
})
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
};
|
||||
|
||||
// We don't use the lines() method because it skips emtpy lines, which is not what we want.
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::convert::TryInto;
|
||||
use espanso_inject::{InjectionOptions, Injector};
|
||||
use std::convert::TryInto;
|
||||
|
||||
use espanso_engine::dispatch::KeyInjector;
|
||||
|
||||
|
@ -31,7 +31,10 @@ pub struct KeyInjectorAdapter<'a> {
|
|||
|
||||
impl<'a> KeyInjectorAdapter<'a> {
|
||||
pub fn new(injector: &'a dyn Injector, params_provider: &'a dyn InjectParamsProvider) -> Self {
|
||||
Self { injector, params_provider }
|
||||
Self {
|
||||
injector,
|
||||
params_provider,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,10 +45,20 @@ impl<'a> KeyInjector for KeyInjectorAdapter<'a> {
|
|||
let injection_options = InjectionOptions {
|
||||
delay: params
|
||||
.key_delay
|
||||
.unwrap_or(InjectionOptions::default().delay.try_into().unwrap())
|
||||
.unwrap_or_else(|| InjectionOptions::default().delay.try_into().unwrap())
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
disable_fast_inject: params.disable_x11_fast_inject,
|
||||
evdev_modifier_delay: params
|
||||
.evdev_modifier_delay
|
||||
.unwrap_or_else(|| {
|
||||
InjectionOptions::default()
|
||||
.evdev_modifier_delay
|
||||
.try_into()
|
||||
.unwrap()
|
||||
})
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
};
|
||||
|
||||
let converted_keys: Vec<_> = keys.iter().map(convert_to_inject_key).collect();
|
||||
|
|
|
@ -32,4 +32,5 @@ pub struct InjectParams {
|
|||
pub inject_delay: Option<usize>,
|
||||
pub key_delay: Option<usize>,
|
||||
pub disable_x11_fast_inject: bool,
|
||||
pub evdev_modifier_delay: Option<usize>,
|
||||
}
|
|
@ -43,6 +43,7 @@ generate_patchable_config!(
|
|||
restore_clipboard_delay -> usize,
|
||||
inject_delay -> Option<usize>,
|
||||
key_delay -> Option<usize>,
|
||||
evdev_modifier_delay -> Option<usize>,
|
||||
word_separators -> Vec<String>,
|
||||
backspace_limit -> usize,
|
||||
apply_patch -> bool,
|
||||
|
|
Loading…
Reference in New Issue
Block a user