can configure keyup/keydown formatting via env
parent
4e41fefe2a
commit
14017302d0
|
|
@ -37,6 +37,14 @@ pub struct Device {
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct GUI {
|
pub struct GUI {
|
||||||
pub buttons: Buttons,
|
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)]
|
#[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")),
|
l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")),
|
||||||
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
|
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,
|
device: None,
|
||||||
udp: Some(UDP{
|
udp: Some(UDP{
|
||||||
|
|
|
||||||
13
src/gui.rs
13
src/gui.rs
|
|
@ -139,9 +139,15 @@ impl Application for Main {
|
||||||
for key_code in self.keys_newly_down.iter() {
|
for key_code in self.keys_newly_down.iter() {
|
||||||
match self.key_code_to_string(key_code) {
|
match self.key_code_to_string(key_code) {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
|
for c in self.flags.cfg.press.prefix.chars() {
|
||||||
|
s.push(c);
|
||||||
|
}
|
||||||
for c in x.chars() {
|
for c in x.chars() {
|
||||||
s.push(c);
|
s.push(c);
|
||||||
}
|
}
|
||||||
|
for c in self.flags.cfg.press.suffix.chars() {
|
||||||
|
s.push(c);
|
||||||
|
}
|
||||||
self.keys_already_down.push(*key_code);
|
self.keys_already_down.push(*key_code);
|
||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
|
|
@ -157,9 +163,14 @@ impl Application for Main {
|
||||||
match self.key_code_to_string(key_code) {
|
match self.key_code_to_string(key_code) {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
for c in x.chars() {
|
for c in x.chars() {
|
||||||
s.push('!');
|
for c in self.flags.cfg.release.prefix.chars() {
|
||||||
s.push(c);
|
s.push(c);
|
||||||
}
|
}
|
||||||
|
s.push(c);
|
||||||
|
for c in self.flags.cfg.release.suffix.chars() {
|
||||||
|
s.push(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"streams": {
|
"streams": {
|
||||||
"input": {
|
"input": {
|
||||||
|
"debug": true,
|
||||||
"engine": {
|
"engine": {
|
||||||
"name": "kinesis",
|
"name": "kinesis",
|
||||||
"kinesis": {
|
"kinesis": {
|
||||||
|
|
@ -10,6 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
|
"debug": true,
|
||||||
"engine": {
|
"engine": {
|
||||||
"name": "kafka",
|
"name": "kafka",
|
||||||
"kafka": {
|
"kafka": {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
streams:
|
streams:
|
||||||
input:
|
input:
|
||||||
|
debug: true
|
||||||
engine:
|
engine:
|
||||||
name: stdin
|
name: stdin
|
||||||
output:
|
output:
|
||||||
|
debug: true
|
||||||
engine:
|
engine:
|
||||||
name: stdout
|
name: stdout
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue