1
0
Fork 0
forked from wry/wry

config: allow consuming/forwarding key events

This commit is contained in:
Julian Orth 2024-04-15 18:42:59 +02:00
parent 6ee4fdb9f4
commit 18bc86d14f
12 changed files with 106 additions and 13 deletions

View file

@ -49,6 +49,7 @@ pub enum SimpleCommand {
ToggleFullscreen,
ToggleMono,
ToggleSplit,
Forward(bool),
}
#[derive(Debug, Clone)]

View file

@ -109,6 +109,8 @@ impl ActionParser<'_> {
"reload-config-toml" => ReloadConfigToml,
"reload-config-so" => ReloadConfigSo,
"none" => None,
"forward" => Forward(true),
"consume" => Forward(false),
_ => {
return Err(ActionParserError::UnknownSimpleAction(string.to_string()).spanned(span))
}

View file

@ -61,6 +61,7 @@ impl Action {
}
SimpleCommand::ReloadConfigSo => Box::new(reload),
SimpleCommand::None => Box::new(|| ()),
SimpleCommand::Forward(bool) => Box::new(move || s.set_forward(bool)),
},
Action::Multi { actions } => {
let mut actions: Vec<_> = actions.into_iter().map(|a| a.into_fn(state)).collect();