feat(core): wire up apply_patch option
This commit is contained in:
parent
4504977384
commit
90db84b92f
|
@ -69,6 +69,10 @@ impl ConfigStore for PatchedConfigStore {
|
||||||
fn active<'f>(&'f self, app: &espanso_config::config::AppProperties) -> Arc<dyn Config> {
|
fn active<'f>(&'f self, app: &espanso_config::config::AppProperties) -> Arc<dyn Config> {
|
||||||
let active_config = self.config_store.active(app);
|
let active_config = self.config_store.active(app);
|
||||||
|
|
||||||
|
if !active_config.apply_patch() {
|
||||||
|
return active_config;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if a patch should be applied
|
// Check if a patch should be applied
|
||||||
if let Some(patch) = self.patches.iter().find(|patch| (patch.should_patch)(app)) {
|
if let Some(patch) = self.patches.iter().find(|patch| (patch.should_patch)(app)) {
|
||||||
(patch.apply)(active_config)
|
(patch.apply)(active_config)
|
||||||
|
|
|
@ -40,5 +40,6 @@ generate_patchable_config!(
|
||||||
inject_delay -> Option<usize>,
|
inject_delay -> Option<usize>,
|
||||||
key_delay -> Option<usize>,
|
key_delay -> Option<usize>,
|
||||||
word_separators -> Vec<String>,
|
word_separators -> Vec<String>,
|
||||||
backspace_limit -> usize
|
backspace_limit -> usize,
|
||||||
|
apply_patch -> bool
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user