feat(core): improve engine flag handling

This commit is contained in:
Federico Terzi 2021-08-10 22:22:45 +02:00
parent c91e8f56bc
commit 88d589e851

View File

@ -41,7 +41,7 @@ use crate::{cli::worker::{context::Context, engine::{dispatch::executor::{clipbo
extension::{clipboard::ClipboardAdapter, form::FormProviderAdapter}, extension::{clipboard::ClipboardAdapter, form::FormProviderAdapter},
RendererAdapter, RendererAdapter,
}, },
}}, match_cache::{CombinedMatchCache, MatchCache}}, common_flags::WORKER_START_REASON_CONFIG_CHANGED, engine::event::ExitMode, preferences::Preferences}; }}, match_cache::{CombinedMatchCache, MatchCache}}, common_flags::{WORKER_START_REASON_CONFIG_CHANGED, WORKER_START_REASON_KEYBOARD_LAYOUT_CHANGED, WORKER_START_REASON_MANUAL}, engine::event::ExitMode, preferences::Preferences};
use super::secure_input::SecureInputEvent; use super::secure_input::SecureInputEvent;
@ -216,10 +216,10 @@ pub fn initialize_and_spawn(
Some(flag) if flag == WORKER_START_REASON_CONFIG_CHANGED => { Some(flag) if flag == WORKER_START_REASON_CONFIG_CHANGED => {
ui_remote.show_notification("Configuration reloaded! Espanso automatically loads new changes as soon as you save them."); ui_remote.show_notification("Configuration reloaded! Espanso automatically loads new changes as soon as you save them.");
} }
Some("manual_restart") => { Some(flag) if flag == WORKER_START_REASON_MANUAL => {
ui_remote.show_notification("Configuration reloaded!"); ui_remote.show_notification("Configuration reloaded!");
} }
Some("keyboard_layout_changed") => { Some(flag) if flag == WORKER_START_REASON_KEYBOARD_LAYOUT_CHANGED => {
ui_remote.show_notification("Updated keyboard layout!"); ui_remote.show_notification("Updated keyboard layout!");
} }
_ => { _ => {