libxkbcommon 1.7.0
|
The purpose of the rules file is to map between configuration values that are easy for a user to specify and understand, and the configuration values xkbcomp uses and understands.
xkbcomp uses the xkb_component_names
struct, which maps directly to include statements of the appropriate sections, called for short KcCGST (see the XKB introduction; 'G' stands for "geometry", which is not supported). These are not really intuitive nor straightforward for the uninitiated.
Instead, the user passes in a xkb_rule_names
struct, which consists of the name of a rules file (in Linux this is usually "evdev"), a keyboard model (e.g. "pc105"), a set of layouts (which will end up in different groups, e.g. "us,fr"), variants (used to alter/augment the respective layout, e.g. "intl,dvorak"), and a set of options (used to tweak some general behavior of the keyboard, e.g. "ctrl:nocaps,compose:menu" to make the Caps Lock key act like Ctrl and the Menu key like Compose). We call these RMLVO.
The file consists of rule sets, each consisting of rules (one per line), which match the MLVO values on the left hand side, and, if the values match to the values the user passed in, results in the values on the right hand side being added to the resulting KcCGST. Since some values are related and repeated often, it is possible to group them together and refer to them by a group name in the rules.
Along with matching values by simple string equality, and for membership in a group defined previously, rules may also contain "wildcard" values - "*" - which always match. These usually appear near the end.
(It might be helpful to look at a file like rules/evdev along with this grammar. Comments, whitespace, etc. are not shown.)
Notes:
In case the expansion is invalid, as described above, it is skipped (the rest of the string is still processed); this includes the prefix and suffix (that's why you shouldn't use e.g. "(%v[1])").