39aldo39 / klfc

Keyboard Layout Files Creator
GNU General Public License v3.0
215 stars 13 forks source link

[macOS] `keylayout` generation does not take into account the top-left key on ANSI keyboards. #42

Open NyaomiDEV opened 2 years ago

NyaomiDEV commented 2 years ago

As noted here: https://github.com/ysoftwareab/xkb-for-macos/issues/3

Turns out KLFC doesn't assign anything to the top-left key in an ANSI keyboard (the one that in US layout has the symbols "`" and "~") when converting an XKB layout. Probably it does so with other formats, though I didn't try.

39aldo39 commented 2 years ago

I don't remember the exact details, but when I looked at it the key does have a separate code in Mac OS for ANSI and ISO keyboards and no way to support both that was clear to me. Looking at the code, I think as a workaround you can change the 'Tilde' position to the 'Iso' position in the KLFC files. Or, by changing code="10" to code="50" directly in the keylayout files.

NyaomiDEV commented 2 years ago

by changing code="10" to code="50" directly in the keylayout files.

Are there problems if the same assignment is made for both codes on MacOS?

39aldo39 commented 2 years ago

Yes, as both keys are present on ISO keyboards. Essentially, the ANSI keyboard is the ISO keyboard, but with the Tilde and Iso keys swapped and then the Iso key removed.

Although it might be an option to do so if the Iso key itself is not defined.