baselayout() statement tests the physical hardware keyboard that the Keyman keyboard is running on top of.
baselayout(layoutName) ... > ... if(&baselayout = layoutName) ... > ...
- The name or identifier of the layout to compare against. This should be an ISO639 Language Name and ISO3166 Country Code pair, separated by
"en-US", or it can be the name of a Windows keyboard DLL, e.g.
"kbdus.dll". The second form is self-evidently not portable, as it relies on Windows DLLs, and is best avoided.
baselayout() statement allows a keyboard to test the user's physical layout and adjust the ruleset accordingly. For example, several Classical Greek keyboards
placed the iota subscript on the | (vertical bar) key. This is reasonably accessible on a US keyboard, but is much harder to find on some European layouts.
Adding an alternate method of accessing the key on a European layout reduces the complexity of using the keyboard.
baselayout() statement is currently only supported on Keyman Desktop for Windows, as determining the base layout on web platforms is inconsistent. The concept of
a base layout is not present on touch devices. On web and touch devices, the
baselayout() test will return
true only for
baselayout() form is cleaner to use than the
if(&baselayout) form. However, the
if() form has one advantage: you can do a
negative test with the
+ '|' > U+0345 baselayout('fr-FR') + '§' > U+0345
baselayout() statement can be used in keyboards on all platforms, but all platforms other than Windows match only on a blank string (
"") at present.
|Windows||macOS||Desktop web||Mobile web||iOS||Android|
Note: full support is available in Keyman Desktop 9.0.511.0 and Keyman Developer 9.0.511.0 and later versions, due to bugs in earlier builds.
baselayout() statement was introduced in Keyman 9.0.