Text macro fix for different keymaps

7 votes

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.

Under consideration Suggested by: Laszlo Kelemen Upvoted: 25 Mar Comments: 3

Comments: 3