From ce802bc72e9c8e7b5b7de53adbc97971703627af Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 21 Aug 2021 08:36:36 +0200 Subject: [PATCH] fix(migrate): adjust wrong migrate fields --- espanso-migrate/src/convert.rs | 23 +++++++++++++++---- .../all_params/expected/config/default.yml | 8 ++----- .../test/all_params/legacy/default.yml | 1 + 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/espanso-migrate/src/convert.rs b/espanso-migrate/src/convert.rs index 01d5b47..6322ec3 100644 --- a/espanso-migrate/src/convert.rs +++ b/espanso-migrate/src/convert.rs @@ -131,22 +131,35 @@ pub fn convert(input_files: HashMap) -> HashMap None, }, ); - copy_field_if_present(yaml, "secure_input_watcher_enabled", &mut output_yaml, "secure_input_watcher_enabled"); - copy_field_if_present(yaml, "secure_input_watcher_interval", &mut output_yaml, "secure_input_watcher_interval"); + //copy_field_if_present(yaml, "secure_input_watcher_enabled", &mut output_yaml, "secure_input_watcher_enabled"); + //copy_field_if_present(yaml, "secure_input_watcher_interval", &mut output_yaml, "secure_input_watcher_interval"); + //copy_field_if_present(yaml, "config_caching_interval", &mut output_yaml, "config_caching_interval"); + //copy_field_if_present(yaml, "use_system_agent", &mut output_yaml, "use_system_agent"); + copy_field_if_present(yaml, "secure_input_notification", &mut output_yaml, "secure_input_notification"); - copy_field_if_present(yaml, "config_caching_interval", &mut output_yaml, "config_caching_interval"); copy_field_if_present(yaml, "toggle_interval", &mut output_yaml, "toggle_interval"); copy_field_if_present(yaml, "toggle_key", &mut output_yaml, "toggle_key"); copy_field_if_present(yaml, "preserve_clipboard", &mut output_yaml, "preserve_clipboard"); copy_field_if_present(yaml, "backspace_limit", &mut output_yaml, "backspace_limit"); - copy_field_if_present(yaml, "fast_inject", &mut output_yaml, "x11_fast_inject"); + map_field_if_present( + yaml, + "fast_inject", + &mut output_yaml, + "disable_x11_fast_inject", + |val| match val { + Yaml::Boolean(false) => Some(Yaml::Boolean(true)), + Yaml::Boolean(true) => Some(Yaml::Boolean(false)), + _ => None, + }, + ); + copy_field_if_present(yaml, "auto_restart", &mut output_yaml, "auto_restart"); copy_field_if_present(yaml, "undo_backspace", &mut output_yaml, "undo_backspace"); copy_field_if_present(yaml, "show_icon", &mut output_yaml, "show_icon"); copy_field_if_present(yaml, "show_notifications", &mut output_yaml, "show_notifications"); copy_field_if_present(yaml, "inject_delay", &mut output_yaml, "inject_delay"); copy_field_if_present(yaml, "restore_clipboard_delay", &mut output_yaml, "restore_clipboard_delay"); - copy_field_if_present(yaml, "use_system_agent", &mut output_yaml, "use_system_agent"); + copy_field_if_present(yaml, "backspace_delay", &mut output_yaml, "key_delay"); copy_field_if_present(yaml, "word_separators", &mut output_yaml, "word_separators"); if yaml.get(&Yaml::String("enable_passive".to_string())).is_some() { diff --git a/espanso-migrate/test/all_params/expected/config/default.yml b/espanso-migrate/test/all_params/expected/config/default.yml index 46d6954..110e976 100644 --- a/espanso-migrate/test/all_params/expected/config/default.yml +++ b/espanso-migrate/test/all_params/expected/config/default.yml @@ -1,5 +1,3 @@ -config_caching_interval: 1200 - toggle_interval: 500 toggle_key: "RIGHT_CTRL" @@ -9,10 +7,9 @@ backspace_limit: 5 inject_delay: 10 restore_clipboard_delay: 400 +key_delay: 300 -secure_input_watcher_enabled: false secure_input_notification: false -secure_input_watcher_interval: 3000 show_notifications: false show_icon: false @@ -20,11 +17,10 @@ show_icon: false auto_restart: false undo_backspace: false -x11_fast_inject: false +disable_x11_fast_inject: true paste_shortcut: "CTRL+ALT+V" backend: Clipboard -use_system_agent: false word_separators: ['.'] \ No newline at end of file diff --git a/espanso-migrate/test/all_params/legacy/default.yml b/espanso-migrate/test/all_params/legacy/default.yml index 04d3256..a788446 100644 --- a/espanso-migrate/test/all_params/legacy/default.yml +++ b/espanso-migrate/test/all_params/legacy/default.yml @@ -9,6 +9,7 @@ backspace_limit: 5 inject_delay: 10 restore_clipboard_delay: 400 +backspace_delay: 300 secure_input_watcher_enabled: false secure_input_notification: false