Keyboard layouts information retrieval

Ken Moffat zarniwhoop at ntlworld.com
Fri Sep 20 19:07:38 UTC 2019


On Fri, Sep 20, 2019 at 11:15:41AM +0200, Glus Xof wrote:
> Hi guys,
> 
> I need to retrieve all keyboard keycodes, levels, keysyms and keyboard
> layout names for all keyboard layouts defined in my X11 system and
> according the current keyboard geometry.
> 
> Which would be the suitable library for ?
> 
> Is there any tutorial, piece of code... ?
> 
> Glus

Hi Glus,

that sounds an uncommon requirement.  I have no idea what you want
to do with that data, but I'll be very surprised if there are any
libraries or tutorials for doing this.  OTOH, it would not be the
first time I've been surprised :)

Anyway, if X is in /usr then xkeyboard-config installs its files in
/usr/share/X11/xkb/.  For example, on a British keyboard the various
options are in /usr/share/X11/xkb/symbols/gb with labels like
 xkb_symbols "dvorak"

But these names are only unique within that 'language' file, and
they usually include various other items (e.g. "us(dvorak-alt-intl)"
for that example.

Depending on exactly why you want to do this, and for how wide a
range of keyboards, it looks like a job for your favourite scripting
language.

Similarly, geometry definitions in xkb/geometry and other files in
compat/ keycodes/ rules/ and types/.

Potentially, your scope is vast (e.g. I could use non-gb non-qwerty
layouts on my standard British keyboard, although the only sane
reason would be if I knew one of those layouts by heart).  In
practice, those of us who use X (possibly without gnome or kde) can
make our own local changes to get modified mappings for things which
are otherwise only in Compose settings.

ĸen
-- 
thread 'main' panicked at 'giraffe',
/tmp/rustc-1.32.0-src/src/test/run-fail/while-panic.rs:17:13


More information about the xorg mailing list