diff --git a/src/config/mod.rs b/src/config/mod.rs index cd1ad94..7816539 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -66,6 +66,8 @@ fn default_restore_clipboard_delay() -> i32 { 300 } fn default_exclude_default_entries() -> bool {false} fn default_secure_input_watcher_enabled() -> bool {true} fn default_secure_input_notification() -> bool {true} +fn default_show_notifications() -> bool {true} +fn default_show_icon() -> bool {true} fn default_secure_input_watcher_interval() -> i32 {5000} fn default_matches() -> Vec { Vec::new() } fn default_global_vars() -> Vec { Vec::new() } @@ -156,6 +158,12 @@ pub struct Configs { #[serde(default = "default_exclude_default_entries")] pub exclude_default_entries: bool, + #[serde(default = "default_show_notifications")] + pub show_notifications: bool, + + #[serde(default = "default_show_icon")] + pub show_icon: bool, + #[serde(default = "default_matches")] pub matches: Vec, @@ -205,6 +213,8 @@ impl Configs { validate_field!(result, self.secure_input_watcher_enabled, default_secure_input_watcher_enabled()); validate_field!(result, self.secure_input_watcher_interval, default_secure_input_watcher_interval()); validate_field!(result, self.secure_input_notification, default_secure_input_notification()); + validate_field!(result, self.show_notifications, default_show_notifications()); + validate_field!(result, self.show_icon, default_show_icon()); result } diff --git a/src/engine.rs b/src/engine.rs index 0527533..79730c7 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -257,7 +257,11 @@ impl <'a, S: KeyboardManager, C: ClipboardManager, M: ConfigManager<'a>, U: UIMa let mut enabled_ref = self.enabled.borrow_mut(); *enabled_ref = status; - self.ui_manager.notify(message); + let config = self.config_manager.default_config(); + + if config.show_notifications { + self.ui_manager.notify(message); + } } fn on_passive(&self) { @@ -351,7 +355,8 @@ impl <'a, S: KeyboardManager, C: ClipboardManager, SystemEvent::SecureInputEnabled(app_name, path) => { info!("SecureInput has been acquired by {}, preventing espanso from working correctly. Full path: {}", app_name, path); - if self.config_manager.default_config().secure_input_notification { + let config = self.config_manager.default_config(); + if config.secure_input_notification && config.show_notifications { self.ui_manager.notify_delay(&format!("{} has activated SecureInput. Espanso won't work until you disable it.", app_name), 5000); } }, diff --git a/src/main.rs b/src/main.rs index dc788fd..739976e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -350,7 +350,9 @@ fn daemon_background(receive_channel: Receiver, config_set: ConfigSet, is let config_manager = RuntimeConfigManager::new(config_set, system_manager); let ui_manager = ui::get_uimanager(); - ui_manager.notify("espanso is running!"); + if config_manager.default_config().show_notifications { + ui_manager.notify("espanso is running!"); + } let clipboard_manager = clipboard::get_manager();