xkb support in kbd
Hi,
I have been working on xkb-based keymap import for kbd and would like to ask for testing and feedback.
The work is here:
https://git.kernel.org/pub/scm/linux/kernel/git/legion/kbd.git/?h=xkb
The idea is to let loadkeys build a linux console keymap directly from xkb settings such as model, layout, variant and options.
This is meant to make it easier to reuse the existing xkb layout data on the linux console instead of relying only on pre-generated console keymaps. In practice, this should make it possible to describe console layouts in the same terms people already use elsewhere in the stack.
Since kernel keymaps and xkb differ significantly, the conversion has to be done on the fly and not everything can be converted.
The groups (the layouts) are placed in the following way:
1 group : gr1->gr1->gr1->...
2 groups: gr1->gr2->gr1->gr2->...
3 groups: gr1->gr2->gr1->gr4->gr1->gr2->gr1->gr4->...
4 groups: gr1->gr2->gr3->gr4->gr1->gr2->gr3->gr4->...This follows the order in which layouts are switched in the console-setup from debian. Special thanks to Anton Zinoviev for the explanations
To build it from a git checkout, configure kbd with xkb support enabled:
./configure --enable-xkb
This requires libxkbcommon to be installed.
Once built, loadkeys accepts xkb parameters directly. For example:
./loadkeys \
--xkb-model=pc105 \
--xkb-layout=us,ru \
--xkb-options=grp:caps_toggleTo inspect the generated keymap without loading it into the kernel:
./loadkeys --tkeymap \
--xkb-model=pc105 \
--xkb-layout=us,ru \
--xkb-options=grp:caps_toggleTesting would be especially useful for:
- non-trivial layouts and variants
- multi-layout setups
- AltGr and higher levels
- group switching options
- compose-heavy layouts
If you try it, reports with the exact loadkeys command line, the expected behavior, and the actual behavior would be very helpful.
In addition, I wrote a proof-of-concept of utility that displays the currently active layout in the top-right corner of the console.
contrib/vcslayout.c
I would also appreciate hearing your comments or suggestions regarding this approach.
Signature · 1 line
Rgrds, legion