Text macro fix for different keymaps
Right now, text macros are wrong when using different language layouts because it assumes default layout. It tries to replace special characters with unicode, but things like "Z" and "Y" still get switched up on QWERTZ layout.
The solution could be a conversion to replace characters by the layout's macro rules.
The mapping for keycodes could be part of the layout .py file. For example, hungarian.py would look like this:
keymap = {
"KC_GRAVE": "§\n0",
"KC_1": "'\n1 ~"
...
}
macromap = {
"y": "z",
"Y": "Z",
"z": "y",
"Z": "Y",
"á": "'",
"Á": "\"",
"é": ";",
"É": ":",
"í": "\\"
...
}
In practice it would work like this:
I have "Hungarian" layout selected, I save "Yes" as a new macro, it saves as "Zes" after converting it with the macromap, and shows up as "Yes" in the gui, because it converts it back for display. When switching to "QWERTY" layout, it would switch back to "Zes" in the gui.
Comments: 3
-
01 Feb, '22
Laszlo KelemenI realized that this cannot completely solve the problem, as not every key combination has a character on the default keymap.
For example, on the Hungarian keymap, CTRL+ALT+B results in "{", but on the default keymap there is no character which could be used to get qmk use these keycodes.
This method also couldn't use KC_NONUS_BSLASH.
So while it's limited, I think it would still be much better if I only had to use tap macros for every "í" instead of every accent letters in "Árvíztűrő tükörfúrógép". -
07 Feb, '22
KraXen72you could generate the macro map by recording the macros in both layouts and then vial could somehow figure out what changed and add substitutes. still doesen't really solve, how would you know which macro to use? the keyboard has no information about the current layout
-
25 Mar
PierreThis really needs to be considered. There is so much confusion in Macros, as working with other language maps doesn't currently allow you to type in a text and simply get it outputed from the macro.