rmk icon indicating copy to clipboard operation
rmk copied to clipboard

Support non-english characters in keymap setting

Open HaoboGu opened this issue 3 months ago • 2 comments

In german layout, there's characters like Ä, ö, etc. They are unicode, but the keycode can be mapped to existing keycode(For example, ö -> 0x33 = Keycode for :;).

Support those characters in keymap could be great, for example:

[[layer]]
keys = """
Ä Ü Ö
"""

The simplest way is to add KEYCODE_ALIAS of those unicode chars.

HaoboGu avatar Oct 07 '25 14:10 HaoboGu

Just do not predefine these aliases in RMK, because Swedish, Danish, German, Hungarian, etc. layouts may all have different position of the "same" letter! And also the symbols which are "covered" by these letters are also remapped to different locations.

In keyboard.toml I use these aliases to support both the US and the Hungarian layout:


[aliases]
# US layout aliases for symbols:
"~"="WM(Grave, LShift)"
"`"="Grave"
"!"="WM(Kc1, LShift)"
"@"="WM(Kc2, LShift)"
"#"="WM(Kc3, LShift)"
"$"="WM(Kc4, LShift)"
"%"="WM(Kc5, LShift)"
"^"="WM(Kc6, LShift)"
"&"="WM(Kc7, LShift)"
"*"="WM(Kc8, LShift)"
"("="WM(Kc9, LShift)"
")"="WM(Kc0, LShift)"
"-"="Minus"
"_"="WM(Minus, LShift)"
"="="Equal"
"+"="WM(Equal, LShift)"
"["="LeftBracket"
"{"="WM(LeftBracket, LShift)"
"]"="RightBracket"
"}"="WM(RightBracket, LShift)"
"\\"="Backslash"
"|"="WM(Backslash, LShift)"
";"="Semicolon"
":"="WM(Semicolon, LShift)"
"'"="Quote"
"\""="WM(Quote, LShift)"
","="Comma"
"<"="WM(Comma, LShift)"
"."="Dot"
">"="WM(Dot, LShift)"
"/"="Slash"
"?"="WM(Slash, LShift)"

# HUN layout aliases for symbols:
"h~"="WM(Kc1, RAlt)"
"h`"="WM(Kc7, RAlt)"
"h!"="WM(Kc4, LShift)"
"h@"="WM(V, RAlt)"
"h#"="WM(X, RAlt)"
"h$"="WM(Semicolon, RAlt)"
"h%"="WM(Kc5, LShift)"
"h^"="WM(Kc3, RAlt)"
"h&"="WM(C, RAlt)"
"h*"="WM(Slash, RAlt)"
"h("="WM(Kc8, LShift)"
"h)"="WM(Kc9, LShift)"
"h-"="Slash"
"h_"="WM(Slash, LShift)"
"h="="WM(Kc7, LShift)"
"h+"="WM(Kc3, LShift)"
"h["="WM(F, RAlt)"
"h{"="WM(B, RAlt)"
"h]"="WM(G, RAlt)"
"h}"="WM(N, RAlt)"
"h\\"="WM(Q, RAlt)"
"h|"="WM(W, RAlt)"
"h;"="WM(Comma, RAlt)"
"h:"="WM(Dot, LShift)"
"h'"="WM(Kc1, LShift)"
"h\""="WM(Kc2, LShift)"
"h,"="Comma"
"h<"="WM(NonusBackslash, RAlt)"
"h."="Dot"
"h>"="WM(Y, RAlt)"
"h/"="WM(Kc6, LShift)"
"h?"="WM(Comma, LShift)"

# HUN layout aliases for special characters:
"í"="Grave"
"ö"="Kc0"
"ü"="Minus"
"ó"="Equal" 
"ő"="LeftBracket"
"ú"="RightBracket"
"ű"="Backslash"
"é"="Semicolon"
"á"="Quote"

tib888 avatar Oct 08 '25 07:10 tib888

Just do not predefine these aliases in RMK, because Swedish, Danish, German, Hungarian, etc. layouts may all have different position of the "same" letter

got it, then we need to provide a way to define those alias in Rust code.

HaoboGu avatar Oct 08 '25 09:10 HaoboGu