Keyboard layouts information retrieval

Glus Xof gtglus at gmail.com
Sun Sep 22 12:22:08 UTC 2019


Hi Ken,

First of all, I must thank you for your courage to answer a question that
probably went incomplete and sounds a little weird.

The idea is to call X11 server directly (maybe using Display). Parsing disk
files (/usr/share/X11/xkb/) could not be good enough, here.

The second focus is to limit the data according to the working keyboard
geometry.

Is there a function to call X11 server for...

a) the current/active/detected/in use keyboard geometry name?
b) the names and/or ids of all defined keyboard layouts for an specific
geometry ?
c) the list of keycodes/levels/keysyms for an specific layout (and
geometry) ?

I'm working in C/C++.

Glus

Missatge de Ken Moffat <zarniwhoop at ntlworld.com> del dia dv., 20 de set.
2019 a les 21:16:

> 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
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: https://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg/attachments/20190922/bf9e14c9/attachment.html>


More information about the xorg mailing list