Where is the upstream source repository for keyboard layouts used in Ubuntu?

I am aware keyboard layouts in Ubuntu are set in two different places: keyboard-configuration/keyboard-setup take effect only on ttys and the logon screen (at a minimum in MATE, not sure about other flavors), and there is a GUI in system settings which affects only the desktop session.

Where can I find the upstream source repositories for the keyboard layouts used (both tty and desktop session) in Ubuntu? If there are differences between versions and flavors, I am specifically interested in Ubuntu MATE 20.04. Right now I don’t even know which packages (or even files on my local systems) to look for.


As per /usr/share/doc/keyboard-configuration/README.Debian:

In Debian the default keyboard layout is shared between the console and X. It is specified in /etc/default/keyboard.

The comments in /etc/default/keyboard (where the keyboard layout for tty is configured) state:

If you don't want to use the XKB layout on the console, you can specify an alternative keymap. Make sure it will be accessible before /usr is mounted.

There are some layout-related files in /etc/console-setup/*.kmap.gz. Their names start with cached, and the timestamp indicates that they are likely auto-generated when setting the keyboard layout. So non-XKB layouts seem to have no practical relevance, at least on a system with a GUI (not 100% sure about console-only systems; feel free to add that information if you have it).

In short, the keyboard layout files for tty and GUI are the same.

The actual keyboard layouts and related files are stored in /usr/share/X11/xkb/. The symbols dir holds the key mappings (i.e. which physical key generates which character when pressed, alone or with modifiers), and rules/evedv.xml appears to be the map of keyboard layouts.

The source code is at https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config.