diff --git a/espanso-config/src/matches/group/loader/yaml/mod.rs b/espanso-config/src/matches/group/loader/yaml/mod.rs
index 1b0aadc..37b63ed 100644
--- a/espanso-config/src/matches/group/loader/yaml/mod.rs
+++ b/espanso-config/src/matches/group/loader/yaml/mod.rs
@@ -17,7 +17,7 @@
* along with espanso. If not, see .
*/
-use crate::{counter::next_id, matches::{Match, Params, TextFormat, UpperCasingStyle, Value, Variable, group::{path::resolve_imports, MatchGroup}}};
+use crate::{counter::next_id, matches::{ImageEffect, Match, Params, TextFormat, UpperCasingStyle, Value, Variable, group::{path::resolve_imports, MatchGroup}}};
use anyhow::Result;
use log::{error, warn};
use parse::YAMLMatchGroup;
@@ -198,6 +198,10 @@ impl TryFrom for Match {
vars,
format: TextFormat::Plain,
})
+ } else if let Some(image_path) = yaml_match.image_path { // TODO: test image case
+ MatchEffect::Image(ImageEffect {
+ path: image_path,
+ })
} else {
MatchEffect::None
};
diff --git a/espanso-config/src/matches/group/loader/yaml/parse.rs b/espanso-config/src/matches/group/loader/yaml/parse.rs
index b7a444d..44545d0 100644
--- a/espanso-config/src/matches/group/loader/yaml/parse.rs
+++ b/espanso-config/src/matches/group/loader/yaml/parse.rs
@@ -17,11 +17,11 @@
* along with espanso. If not, see .
*/
-use std::{collections::HashMap, path::Path};
+use std::{path::Path};
use anyhow::Result;
use serde::{Deserialize, Serialize};
-use serde_yaml::{Mapping, Value};
+use serde_yaml::{Mapping};
use crate::util::is_yaml_empty;
@@ -68,7 +68,7 @@ pub struct YAMLMatch {
pub replace: Option,
#[serde(default)]
- pub image_path: Option, // TODO: map
+ pub image_path: Option,
#[serde(default)]
pub form: Option,
diff --git a/espanso-config/src/matches/mod.rs b/espanso-config/src/matches/mod.rs
index e9bfcc6..402a686 100644
--- a/espanso-config/src/matches/mod.rs
+++ b/espanso-config/src/matches/mod.rs
@@ -94,7 +94,7 @@ pub enum UpperCasingStyle {
pub enum MatchEffect {
None,
Text(TextEffect),
- // TODO: image
+ Image(ImageEffect),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -121,6 +121,19 @@ impl Default for TextEffect {
}
}
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct ImageEffect {
+ pub path: String,
+}
+
+impl Default for ImageEffect {
+ fn default() -> Self {
+ Self {
+ path: String::new(),
+ }
+ }
+}
+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Variable {
pub id: StructId,