public inbox for kbd@lists.linux.dev
 help / color / mirror / Atom feed
From: Alexey Gladkov <legion@kernel.org>
To: linux console tools development discussion <kbd@lists.linux.dev>
Subject: [RFC] xkb support in kbd
Date: Fri, 27 Mar 2026 16:12:04 +0100	[thread overview]
Message-ID: <acaeRGzry-edlnII@example.org> (raw)

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_toggle

To inspect the generated keymap without loading it into the kernel:

    ./loadkeys --tkeymap \
        --xkb-model=pc105 \
        --xkb-layout=us,ru \
        --xkb-options=grp:caps_toggle

Testing 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. 

-- 
Rgrds, legion


                 reply	other threads:[~2026-03-27 15:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acaeRGzry-edlnII@example.org \
    --to=legion@kernel.org \
    --cc=kbd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox