diff --git a/docs/config.adoc b/docs/config.adoc index d125a8b26..d59440802 100644 --- a/docs/config.adoc +++ b/docs/config.adoc @@ -63,10 +63,11 @@ amount of whitespace (spaces, tabs, newlines) are not relevant. You may use spaces, tabs, or newlines however you like to visually format `defsrc` to your liking. -The the primary source of all key names is the -https://github.com/jtroo/kanata/blob/main/parser/src/keys/mod.rs[str_to_oscode] -function in the source code. Please feel free to file an issue if you're unable -to find the key you're looking for. +The the primary source of all key names are the +`str_to_oscode` and `default_mappings` functions in +https://github.com/jtroo/kanata/blob/main/parser/src/keys/mod.rs[the source]. +Please feel welcome to file an issue +if you're unable to find the key you're looking for. An example `defsrc` containing the US QWERTY keyboard keys as an approximately 60% keyboard layout: diff --git a/parser/src/keys/mod.rs b/parser/src/keys/mod.rs index 4cb36a6c6..0b49e541f 100644 --- a/parser/src/keys/mod.rs +++ b/parser/src/keys/mod.rs @@ -66,6 +66,10 @@ fn add_default_str_osc_mappings(mapping: &mut HashMap) { (",", OsCode::KEY_COMMA), (".", OsCode::KEY_DOT), ("\\", OsCode::KEY_BACKSLASH), + // Mapped as backslash because in some locales/fonts, yen=backslash + ("yen", OsCode::KEY_BACKSLASH), + // Unicode yen is probably the yen key, so map this to a separate oscode by default. + ("¥", OsCode::KEY_YEN), ]; for dm in default_mappings { mapping.entry(dm.0.into()).or_insert(dm.1); @@ -109,7 +113,7 @@ pub fn str_to_oscode(s: &str) -> Option { "p" => OsCode::KEY_P, "lbrc" => OsCode::KEY_LEFTBRACE, "rbrc" => OsCode::KEY_RIGHTBRACE, - "bksl" | "yen" | "¥" => OsCode::KEY_BACKSLASH, + "bksl" => OsCode::KEY_BACKSLASH, "caps" => OsCode::KEY_CAPSLOCK, "a" => OsCode::KEY_A, "s" => OsCode::KEY_S,