How to map a console keyboard layout to a X keyboard layout in Linux

consolekeyboard-layoutx11

In my distribution (Slackware 13.37), the console keyboard layout is chosen among some of those available in /usr/share/kbd/keymaps ' sub directories, coming from the kbd package.

Under X instead the keyboard layout is chosen in a "layout" list included in the file /etc/X11/xkb/rules/evdev.lst.

Does anybody knows a way to, given some console keyboard layout, map it to an X keyboard layout, in order to set up accordingly the "XkbLayout" option in an X configuration file?

I am specially interested in knowing the way other distributions than Slackware deal with this for initial configuration.

Best Answer

Well, how I understand it, in Debian, in /etc/default/keyboard you set the variables XKB{MODEL,LAYOUT,VARIANT,OPTIONS} with values you would use for XKB.

Then, at bootup, setupcon(1) reads those variables and calls ckbcomp(1), which, as its manpage says, “compile[s] a XKB keyboard description to a keymap suitable for loadkeys or kbdcontrol“.

Finally, loadkeys(1) is called on the compiled file.

HTH.

(Or maybe you meant the opposite. I'm not really sure now...)

Related Question