Project: Linux to Windows Keyboard Layout Converter

Project: Linux to Windows Keyboard Layout Converter

Current State

Collecting material.
Trying to understand xkbcom (xkbcomp – compile XKB keyboard description) … is this the parser in Linux?


– Windows and Linux layouts as plain text
– Windows layout: Comprehension of Windows layout, think I could create those, including dead key combinations, etc.
– Linux layout: Basic grasp of the key definitions, including dead key definitions
– xkbcomp : Suspected “parser” of layouts in Linux. Have the source of it and can build that.
— Well, Eclipse builds (the .o-files) but cannot run. Running from terminal with ./xkbcomp --help works though.

Don’t have

– Linux layout:
— Where are dead key combinations defined? Where are definitions of common keys like F1, F2, … ESC, Return?
— What program parses these layouts? Suspect xkbcomp, but don’t understand it’s usage.

Linux layout

It IS in /usr/share/X11/xkb/…!
Possible models and layouts are defined in the rules-dir.
I edited the description in base.lst resp. base.xml, when I looked at xorg.lst resp. xorg.xml, the files already contained the modifications from the base-files.
Gnome shows the edited description from evdev.xml though.

/etc/conf.d/keymaps: keymap=”us-acentos”

us-acentos is in /usr/share/keymaps/i386/qwerty/
gunzip that and it contains … things like:

keymaps 0-2,4-6,8-9,12
keycode 26 = bracketleft braceleft
    control keycode 26 = Escape
    alt keycode 26 = Meta_bracketleft
    shift alt keycode 26 = Meta_braceleft
string F1 = "33[[A"
compose '"' 'a' to 'ä'

Note: In gnome-terminal, last line shows ‘�’ instead of ‘ä’, gedit shows correct symbol.
Should fix this … something still wrong with my Gentoo config.


I use:

/usr/share/consolefonts/lat0-16.psfu.gz: contains a binary file, so that is no help atm
/usr/share/consoletrans/8859-1_to_uni.trans: Plain text file, containing:

0x00    U+0000  # NULL
0x01    U+0001  # START OF HEADING
0x41    U+0041  # LATIN CAPITAL LETTER A
0x42    U+0042  # LATIN CAPITAL LETTER B

Note: Umlaut somehow is diaresis, ‘ä’ is “a with diaresis”.
See: Diaeresis (engl. Wikipedia), Trema (german. Wikipedia). For my case it seems to be the same.

XKB – X Keyboard Extension

Folders in /usr/share/X11/xkb/:
– compat: from compat/README: XKB uses reserved bits in core protocol events. To avoid problems with non-XKB clients, a re-mapping to core modifier masks is provided.
– geometry: keyboard geometry and their anomalies.
– keycodes: Specifies interpretation of the raw keycodes reported by the device. Sets the keycodes symbolic name and the symbolic name for each key
– keymap: Obsolete stuff. … set up one pre-defined keyboard from a given set. Obsoleted by ‘rules’ component … In keymap/xfree86, I find: default=us and keymaps like “us_intl”, “ch_DE”, etc.
– rules: definitions of models and layouts
– semantics: Include … for xkb_types and xkb_compatibility.
– symbols: My keymap is in symbols/us, see /usr/share/X11/xkb/symbols/us
– types: This is interesting stuff, for example: types/pc:

// Some types that are necessary for a full implementation of a PC compatible keyboard.
virtual_modifiers Alt;
virtual_modifiers LevelThree;
virtual_modifiers LAlt;

    modifiers = Control;
    map[None] = Level1;
    map[Control] = Level2;
    level_name[Level1] = "Base";
    level_name[Level2] = "Control";


I suspect xkbcomp to parse the stuff in /usr/share/X11/xkb/ but could be mistaken.


XKB – X Keyboard Extension
man xkbcomp
Wikipedia: X keyboard extension: External Links

The X Keyboard Extension: Protocol Specification – HTML, PDF
Some words about XKB internals


Don’t ask … well, here’s the story?
Windows implementation of US-international keyboard layout sucks.

I found an alternative at: USA International (AltGr dead keys) on Windows, but it’s not exactly what I started to like in Linux.

But that project is using The Microsoft Keyboard Layout Creator.
Nifty tool to customize keyboard layouts.
Even better, the layout format is plain text, see United States-International (AltGr dead keys).klc.

In Gentoo-Linux, the desired layout seems to be defined in /usr/share/X11/xkb/symbols/us, also plain text.

I got bored halfway through manually converting the layout and started thinking about a converter.

Why … because I want to … want to understand, want to be able to!



  1. How is this coming? There really should be a general linux windows windowsPKL OSX converter for keyboard layouts. If you put what you have up, maybe we can make a public project that will do this. email me ( firstname dot lastname at gmail ) if you’re interested.

    1. I don’t plan on doing anything in that direction, sorry.
      If anyone forces me to work on Windows (and pays the extra charge for the torture), then I would just get my preferred keyboard layout up and running on Windows.

      Look at USA International (AltGr dead keys) on Windows, it’s not perfect but a start.
      That project is using The Microsoft Keyboard Layout Creator.
      So I’d just alter the layout of the mentioned project (which still has some dead keys which I don’t want), until I can use the few extra characters that I need for German/French and get rid of those dead keys completly, like the Linux “USA International (AltGr dead keys)” that I use.
      That might take me an hour or so, the mentioned converter is on quite a different scale imho.

  2. Just wanted to share a relevant script: In my experience, it’s finicky about sophisticated handmade keyboard layouts but it’s certainly a start.

    1. Thanks a lot!
      This looks awesome – will have to test it though. But codewise forking this might safe a lot of work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: