diff --git a/espanso/src/cli/modulo/form.rs b/espanso/src/cli/modulo/form.rs index 7c369ab..8124d30 100644 --- a/espanso/src/cli/modulo/form.rs +++ b/espanso/src/cli/modulo/form.rs @@ -38,13 +38,14 @@ pub fn form_main(matches: &ArgMatches, _icon_paths: &IconPaths) -> i32 { std::fs::read_to_string(input_file).expect("unable to read input file") }; - let config: config::FormConfig = if !as_json { + let mut config: config::FormConfig = if !as_json { serde_yaml::from_str(&data).expect("unable to parse form configuration") } else { serde_json::from_str(&data).expect("unable to parse form configuration") }; - // TODO: inject the icon on Windows + // Overwrite the icon + config.icon = _icon_paths.form_icon.as_deref().map(|path| path.to_string_lossy().to_string()); let form = generator::generate(config); let values = show(form); diff --git a/espanso/src/cli/worker/engine/mod.rs b/espanso/src/cli/worker/engine/mod.rs index 51a47c6..49eb9ec 100644 --- a/espanso/src/cli/worker/engine/mod.rs +++ b/espanso/src/cli/worker/engine/mod.rs @@ -29,8 +29,6 @@ use ui::selector::MatchSelectorAdapter; use crate::{cli::worker::engine::{matcher::regex::RegexMatcherAdapterOptions, path::PathProviderAdapter}, engine::event::ExitMode}; -use crate::icon::IconPaths; - pub mod executor; pub mod match_cache; pub mod matcher; @@ -44,7 +42,6 @@ pub fn initialize_and_spawn( paths: Paths, config_store: Box, match_store: Box, - icon_paths: IconPaths, ui_remote: Box, exit_signal: Receiver<()>, ui_event_receiver: Receiver, @@ -63,8 +60,8 @@ pub fn initialize_and_spawn( let match_cache = super::engine::match_cache::MatchCache::load(&*config_store, &*match_store); let modulo_manager = crate::gui::modulo::manager::ModuloManager::new(); - let modulo_form_ui = crate::gui::modulo::form::ModuloFormUI::new(&modulo_manager, &icon_paths.form_icon); - let modulo_search_ui = crate::gui::modulo::search::ModuloSearchUI::new(&modulo_manager, &icon_paths.search_icon); + let modulo_form_ui = crate::gui::modulo::form::ModuloFormUI::new(&modulo_manager); + let modulo_search_ui = crate::gui::modulo::search::ModuloSearchUI::new(&modulo_manager); let (detect_source, modifier_state_store, sequencer) = super::engine::source::init_and_spawn().expect("failed to initialize detector module"); diff --git a/espanso/src/cli/worker/mod.rs b/espanso/src/cli/worker/mod.rs index e43933a..631e18c 100644 --- a/espanso/src/cli/worker/mod.rs +++ b/espanso/src/cli/worker/mod.rs @@ -94,7 +94,6 @@ fn worker_main(args: CliModuleArgs) -> i32 { paths.clone(), config_store, match_store, - icon_paths, remote, engine_exit_receiver, engine_ui_event_receiver, diff --git a/espanso/src/gui/modulo/form.rs b/espanso/src/gui/modulo/form.rs index 5dc04a6..3491760 100644 --- a/espanso/src/gui/modulo/form.rs +++ b/espanso/src/gui/modulo/form.rs @@ -19,7 +19,7 @@ use serde::Serialize; use serde_json::{json, Map, Value}; -use std::{collections::HashMap, path::PathBuf}; +use std::{collections::HashMap}; use crate::gui::{FormField, FormUI}; @@ -27,14 +27,12 @@ use super::manager::ModuloManager; pub struct ModuloFormUI<'a> { manager: &'a ModuloManager, - icon_path: Option, } impl<'a> ModuloFormUI<'a> { - pub fn new(manager: &'a ModuloManager, icon_path: &Option) -> Self { + pub fn new(manager: &'a ModuloManager) -> Self { Self { manager, - icon_path: icon_path.as_ref().map(|path| path.to_string_lossy().to_string()), } } } @@ -46,7 +44,6 @@ impl<'a> FormUI for ModuloFormUI<'a> { fields: &HashMap, ) -> anyhow::Result>> { let modulo_form_config = ModuloFormConfig { - icon: self.icon_path.as_deref(), title: "espanso", layout, fields: convert_fields_into_object(fields), @@ -74,7 +71,6 @@ impl<'a> FormUI for ModuloFormUI<'a> { #[derive(Debug, Serialize)] struct ModuloFormConfig<'a> { - icon: Option<&'a str>, title: &'a str, layout: &'a str, fields: Map, diff --git a/espanso/src/gui/modulo/search.rs b/espanso/src/gui/modulo/search.rs index 0859d32..7c5808f 100644 --- a/espanso/src/gui/modulo/search.rs +++ b/espanso/src/gui/modulo/search.rs @@ -19,7 +19,7 @@ use serde::Serialize; use serde_json::Value; -use std::{collections::HashMap, path::PathBuf}; +use std::{collections::HashMap}; use crate::gui::{SearchItem, SearchUI}; @@ -27,14 +27,12 @@ use super::manager::ModuloManager; pub struct ModuloSearchUI<'a> { manager: &'a ModuloManager, - icon_path: Option, } impl<'a> ModuloSearchUI<'a> { - pub fn new(manager: &'a ModuloManager, icon_path: &Option) -> Self { + pub fn new(manager: &'a ModuloManager) -> Self { Self { manager, - icon_path: icon_path.as_ref().map(|path| path.to_string_lossy().to_string()), } } } @@ -42,7 +40,6 @@ impl<'a> ModuloSearchUI<'a> { impl<'a> SearchUI for ModuloSearchUI<'a> { fn show(&self, items: &[SearchItem]) -> anyhow::Result> { let modulo_config = ModuloSearchConfig { - icon: self.icon_path.as_deref(), title: "espanso", items: convert_items(&items), }; @@ -69,7 +66,6 @@ impl<'a> SearchUI for ModuloSearchUI<'a> { #[derive(Debug, Serialize)] struct ModuloSearchConfig<'a> { - icon: Option<&'a str>, title: &'a str, items: Vec>, }