worf warden use key code

This commit is contained in:
Alexander Mohr 2025-05-25 17:54:38 +02:00
parent ec110d1d91
commit fcfd5c932d
2 changed files with 24 additions and 5 deletions

View file

@ -178,7 +178,7 @@ fn key_type_all() -> KeyBinding {
fn key_type_all_and_enter() -> KeyBinding {
KeyBinding {
key: Key::Exclamation,
key: Key::Num1,
modifiers: vec![Modifier::Alt, Modifier::Shift].into_iter().collect(),
label: String::new(),
visible: false,
@ -196,7 +196,7 @@ fn key_type_user() -> KeyBinding {
fn key_type_user_and_enter() -> KeyBinding {
KeyBinding {
key: Key::At,
key: Key::Num2,
modifiers: vec![Modifier::Alt, Modifier::Shift].into_iter().collect(),
label: String::new(),
visible: false,
@ -214,7 +214,7 @@ fn key_type_password() -> KeyBinding {
fn key_type_password_and_enter() -> KeyBinding {
KeyBinding {
key: Key::Hash,
key: Key::Num3,
modifiers: vec![Modifier::Alt, Modifier::Shift].into_iter().collect(),
label: String::new(),
visible: false,
@ -232,7 +232,7 @@ fn key_type_totp() -> KeyBinding {
fn key_type_totp_and_enter() -> KeyBinding {
KeyBinding {
key: Key::Dollar,
key: Key::Num4,
modifiers: vec![Modifier::Alt, Modifier::Shift].into_iter().collect(),
label: String::new(),
visible: false,

View file

@ -369,7 +369,7 @@ pub struct Config {
#[clap(long = "emoji-hide-string")]
emoji_hide_label: Option<bool>,
#[clap(long = "keyboard-detection-type")]
#[clap(long = "key-detection-type")]
key_detection_type: Option<KeyDetectionType>,
}
@ -832,3 +832,22 @@ pub fn fork_if_configured(config: &Config) {
std::process::exit(0);
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_parse_keyboard_type() {
let toml_str = r#"
key_detection_type="Code"
"#;
let config: Config = toml::from_str(toml_str).expect("Failed to parse TOML");
assert_eq!(config.key_detection_type(), KeyDetectionType::Code);
}
}