Is there an API or a method for detecting which of the three main keyboard layouts – ANSI, ISO, or Japanese – a Mac notebook uses?
After fairly extensive research, I could not find any information about this.
Is there an API or a method for detecting which of the three main keyboard layouts – ANSI, ISO, or Japanese – a Mac notebook uses?
After fairly extensive research, I could not find any information about this.
After countless hours of searching and digging through dusty manuals, I finally found a way to determine physical keyboard layout types attached to the Mac.
By using ancient
CarbonAPIs, you can callKBGetLayoutTypein combination withLMGetKbdTypeto return the desired constants. This amazingly still works in macOS Monterey.To anyone whose looking for a solution in the future, here it is using Swift 5.5: