can configure keyup/keydown formatting via env
parent
4e41fefe2a
commit
14017302d0
|
|
@ -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{
|
||||
|
|
|
|||
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() {
|
||||
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 => {},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"streams": {
|
||||
"input": {
|
||||
"debug": true,
|
||||
"engine": {
|
||||
"name": "kinesis",
|
||||
"kinesis": {
|
||||
|
|
@ -10,6 +11,7 @@
|
|||
}
|
||||
},
|
||||
"output": {
|
||||
"debug": true,
|
||||
"engine": {
|
||||
"name": "kafka",
|
||||
"kafka": {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
streams:
|
||||
input:
|
||||
debug: true
|
||||
engine:
|
||||
name: stdin
|
||||
output:
|
||||
debug: true
|
||||
engine:
|
||||
name: stdout
|
||||
|
|
|
|||
Loading…
Reference in New Issue