I am using a laptop with its internal keyboard and an external keyboard when not on the go. Both keyboards have different layouts, therefore I've figured out two different sets of XkbOptions to make the most of this situation with Xorg [1]. However there doesn't seem to be a way to make this kind of setup work with wayland compositors based on libinput. I've spoken to the respective authors and it appears that the only way of changing keyboard configuration is by setting environment variables like `XKBOPTIONS`. The libinput API doesn't seem to cover programmatic access and modification of keyboards either, only pointer devices. Please let me know if I'm wrong about this, otherwise consider this an enhancement request. [1]: https://github.com/wasamasa/dotfiles/blob/master/etc/X11/xorg.conf.d/20-keyboards.conf
Hi, the library you are looking for to programmatically configure is xkbcommon, http://xkbcommon.org/ . Each compositor has it's own way of configuring things. If you really need two completely separate keyboard configurations, it might be necessary to assign the keyboard devices to two different 'wl_seat' objects. That way they become independent.
see Pekka's answer, libinput sits below xkb and merely forwards the keycodes, independent of any layout that may be applied later. The layout configuration is the task of the compositor, not something we do/can/want to control from within libinput
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.