diff --git a/src/config/mod.rs b/src/config/mod.rs index 073e0f1..154dccf 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -46,7 +46,6 @@ fn default_parent() -> String{ "self".to_owned() } fn default_filter_title() -> String{ "".to_owned() } fn default_filter_class() -> String{ "".to_owned() } fn default_filter_exec() -> String{ "".to_owned() } -fn default_disabled() -> bool{ false } fn default_log_level() -> i32 { 0 } fn default_conflict_check() -> bool{ true } fn default_ipc_server_port() -> i32 { 34982 } @@ -60,6 +59,8 @@ fn default_passive_match_regex() -> String{ "(?P:\\p{L}+)(/(?P.*)/)? fn default_passive_arg_delimiter() -> char { '/' } fn default_passive_arg_escape() -> char { '\\' } fn default_passive_key() -> KeyModifier { KeyModifier::OFF } +fn default_enable_passive() -> bool { false } +fn default_enable_active() -> bool { true } fn default_action_noop_interval() -> u128 { 500 } fn default_backspace_limit() -> i32 { 3 } fn default_exclude_default_matches() -> bool {false} @@ -82,9 +83,6 @@ pub struct Configs { #[serde(default = "default_filter_exec")] pub filter_exec: String, - #[serde(default = "default_disabled")] - pub disabled: bool, - #[serde(default = "default_log_level")] pub log_level: i32, @@ -124,6 +122,12 @@ pub struct Configs { #[serde(default = "default_passive_key")] pub passive_key: KeyModifier, + #[serde(default = "default_enable_passive")] + pub enable_passive: bool, + + #[serde(default = "default_enable_active")] + pub enable_active: bool, + #[serde(default = "default_action_noop_interval")] pub action_noop_interval: u128, diff --git a/src/engine.rs b/src/engine.rs index 4145d48..a971a4f 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -135,7 +135,7 @@ impl <'a, S: KeyboardManager, C: ClipboardManager, M: ConfigManager<'a>, U: UIMa fn on_match(&self, m: &Match, trailing_separator: Option) { let config = self.config_manager.active_config(); - if config.disabled { + if !config.enable_active { return; } @@ -269,6 +269,12 @@ impl <'a, S: KeyboardManager, C: ClipboardManager, M: ConfigManager<'a>, U: UIMa return; } + let config = self.config_manager.active_config(); + + if !config.enable_passive { + return; + } + info!("Passive mode activated"); // Trigger a copy shortcut to transfer the content of the selection to the clipboard @@ -281,8 +287,6 @@ impl <'a, S: KeyboardManager, C: ClipboardManager, M: ConfigManager<'a>, U: UIMa let clipboard = self.clipboard_manager.get_clipboard(); if let Some(clipboard) = clipboard { - let config = self.config_manager.active_config(); - let rendered = self.renderer.render_passive(&clipboard, &config);