diff --git a/src/config.rs b/src/config.rs index e9827c4..1681c7c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -37,6 +37,14 @@ pub struct Device { #[derive(Serialize, Deserialize, Debug)] pub struct GUI { pub buttons: Buttons, + pub press: PreSufFix, + pub release: PreSufFix, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct PreSufFix { + pub prefix: String, + pub suffix: String, } #[derive(Serialize, Deserialize, Debug)] @@ -110,6 +118,14 @@ fn build_config_std() -> Config { l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")), r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")), }, + press: PreSufFix{ + prefix: env::var("INPUT_GUI_PRESS_PREFIX").unwrap_or(String::from("")), + suffix: env::var("INPUT_GUI_PRESS_SUFFIX").unwrap_or(String::from("")), + }, + release: PreSufFix{ + prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("!")), + suffix: env::var("INPUT_GUI_RELEASE_SUFFIX").unwrap_or(String::from("")), + }, }), device: None, udp: Some(UDP{ diff --git a/src/gui.rs b/src/gui.rs index dd466be..7843557 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -139,9 +139,15 @@ impl Application for Main { for key_code in self.keys_newly_down.iter() { match self.key_code_to_string(key_code) { Some(x) => { + for c in self.flags.cfg.press.prefix.chars() { + s.push(c); + } for c in x.chars() { s.push(c); } + for c in self.flags.cfg.press.suffix.chars() { + s.push(c); + } self.keys_already_down.push(*key_code); }, None => {}, @@ -157,8 +163,13 @@ impl Application for Main { match self.key_code_to_string(key_code) { Some(x) => { for c in x.chars() { - s.push('!'); + for c in self.flags.cfg.release.prefix.chars() { + s.push(c); + } s.push(c); + for c in self.flags.cfg.release.suffix.chars() { + s.push(c); + } } }, None => {}, diff --git a/src/testdata/config-kinesis-to-kafka.json b/src/testdata/config-kinesis-to-kafka.json index af334a1..103d300 100644 --- a/src/testdata/config-kinesis-to-kafka.json +++ b/src/testdata/config-kinesis-to-kafka.json @@ -1,6 +1,7 @@ { "streams": { "input": { + "debug": true, "engine": { "name": "kinesis", "kinesis": { @@ -10,6 +11,7 @@ } }, "output": { + "debug": true, "engine": { "name": "kafka", "kafka": { diff --git a/src/testdata/config-stdin-to-stdout.yaml b/src/testdata/config-stdin-to-stdout.yaml index 1ec2163..5d20d6b 100644 --- a/src/testdata/config-stdin-to-stdout.yaml +++ b/src/testdata/config-stdin-to-stdout.yaml @@ -1,7 +1,9 @@ streams: input: + debug: true engine: name: stdin output: + debug: true engine: name: stdout