Replies: 1 comment 4 replies
-
CC @mahkoh as an XKB expert |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This a request of comments (RFC) about an evolution of XKB and the
libxkbcommon
library; see this introduction for further details.Abstract
Add a new type of XKB configuration files, transformations, in order to simplify customization of keymaps:
Sample of the new syntax:
Motivation
There are some use cases that are poorly supported in current XKB:
The limitation is that the XKB format can only set key symbols explicitly and has no generic way to swap/copy keys/levels.
Furthermore, there is always a tension between XKB options and desktop environments (DE) shortcuts. Indeed, the set of options proposed by
xkeyboard-config
is limited and some features are just not supported by XKB, so DE have to deal with 2 interfaces to rebind keys: XKB and their own shortcut handling. DE could produce their own XKB files, but the current API does not give access to some key properties, such as: key type, actions, modifier map, etc. This is a deliberate design choice. Besides, this would require a deep understanding of XKB and creating a XKB keymap generator, which should not be necessary for simple tasks such as “swap two keys”.Finally, keymap components, include mechanism and rules are not always easy to grasp. It can be easier to modify a keymap once its KcCGST components are assembled, i.e. without dealing directly with KcCGST components dependencies.
Rationale
We propose to add a new kind of configuration files, transformations, in order to enable the following modifications of KcCGST components:
“Transformations” are not a new keymap component, but rather just a new keymap section (syntax only). They contribute to the keymap compilation but are not encoded in the compiled keymap.
Rules are extended with a new target component (RHS):
transforms
.Specification
Introduction of the
xkb_transforms
keymap sectionxkb_keymap
is extended with thexkb_transforms
section.The corresponding files are located in the directory
transforms
of the XKB file hierarchy.Grammar
(partial)
TODO: syntax & semantics
Note that contrary to the other sections, the section declaration is optional in
transforms
files, i.e. the following two syntaxes are equivalent. However they cannot be mixed.Compilation stage
Keymap transformations are applied just before computing the derived keymap fields.
Edge cases
Extension of rules files with
transforms
target sectionRules grammar is updated as follow:
Default transformations
There is a special
transforms
file,default
, that is always included first, if present.Examples
xkb_transforms
sectionRMLVO base config:
evdev
pc105
us,de
(none)
(none)
Rules
Backwards Compatibility
xkb_transforms
keymap section or the newtransforms
rules target section.In order to maintain compatibility in XKB files, one may extend the system configuration by adding an extra include path and proceed in the same way than user-configuration, e.g. with
evdev
:EXTRA/XKB/PATH/rules/evdev
: starts with!include evdev
, then adds rules with= transforms
.EXTRA/XKB/PATH/rules/evdev.xml
: adds options that require transformations files.Rejected Ideas
xkb_keymap
is read-only and we would like to preserve that property. We could still clone the keymap and modify it within an internal API, but things get complicated once reaching the derived field step.symbols
section, we could not make transformation across groups in such file. It seems also clearer to have dedicated section type for this RFC’s use cases.Open Issues
@bluetech @whot
Beta Was this translation helpful? Give feedback.
All reactions