Skip to content

Instantly share code, notes, and snippets.

@santileortiz
Created October 16, 2018 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santileortiz/e3fde9c4a6c768dcf2a50caa89fafebf to your computer and use it in GitHub Desktop.
Save santileortiz/e3fde9c4a6c768dcf2a50caa89fafebf to your computer and use it in GitHub Desktop.
commands I use to study/debug keymaps in Linux
Current (unresolved) keymap file
================================
The following command prints one include statement for each component of the
current keymap:
$ setxkbmap -print
Note that this is not a resolved keymap file!. Quite the opposite, it shows
what will be passed to xkbcomp as components so that it resolves them to an
actual keymap. A possible output could be:
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+latam+us:2+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};
When passed into xkbcomp each include statement will be 'resolved'. This
resolution process takes the string "pc+latam+us:2+inet(evdev)" and interprets
it as follows: Merge files "pc" and "latam", then merge the "us" file
into the 2nd group, finally merge the component named "evdev" inside the "inet"
file. Because this include statement is inside a component of type xkb_symbols,
the files "us", "latam", "pc" and "inet" will be looked for inside the
<xkb data>/symbols/ directory.
NOTE: <xkb data> is usually /usr/share/X11/xkb/
Get current resolved file
=========================
To print the current keymap but after resolution use:
$ xkbcomp -xkb $DISPLAY resolved_keymap.xkb
NOTE: It does not output to stdout but instead writes into resolved_keymap.xkb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment