Layout generation using XKB

I got a little tired of editing the keyboard layouts, and thought it would be better to do it programmatically. Linux’s XKB system has a slightly clunky but programmable tool to generate PDFs of whatever combination of keyboard layout and keymap you want (this is what normally comes up when you choose “keyboard viewer” in the settings).

I found a kinesis layout description and updated it to approximate the Model01. It isn’t as pretty as Jesse’s SVGs, or even the keyboard editor. But it does have the advantage that I can run off a batch of keyboard layouts with one bash script.

The source files are on github for your enjoyment (caveat: still very much a work in progress)

And here is some sample output for the default layout using Linux US_ASCII (should be the same on other OSes):

(EDIT: I just noticed I have the modifiers ordered the way I like them, rather than the default. Fixed in the source.)

Note for non-linux people: Super=Windows and Meta=Alt. I think it came up that way due to the order in which aliases are defined in XKB. Note also that the wheel like symbol is apparently a symbol for Control (who knew?). I enabled this (also the symbols for Escape etc.) because the text “Control_L” spilled over the edges of the keys.


XKB sounds like a Soviet era Spec Ops team… now doing IT work.

1 Like

XKGB - Russian black ops keyboard layout
XKCB - Sysadmin keyboard layout
KKKB - Internet troll keyboard layout


1 Like

I prefer XKCD and XFCE


I’ve now updated the scripts to use ultra-simple config files for generating printable layouts. The default config file is this:

LR0="PROG AE01 AE02 AE03 AE04 AE05 LED" # number row, left hand
LR1="TLDE AD01 AD02 AD03 AD04 AD05 TAB" # 
LR2="PGUP AC01 AC02 AC03 AC04 AC05 ESC" # home row, left hand
LR3="PGDN AB01 AB02 AB03 AB04 AB05"	#

LTH="LCTL BKSP LWIN LFSH"		# thumb keys, left hand
LPA="FN"				# palm key, left hand

RR0="ANY  AE06 AE07 AE08 AE09 AE10 NUM"  # number row, right hand
RR1="RTRN AD06 AD07 AD08 AD09 AD10 AE11" # 
RR2="BFLY AC06 AC07 AC08 AC09 AC10 AC11" # home row, right hand
RR3="     AB06 AB07 AB08 AB09 AB10 AE12" #
RTH="RTSH RALT SPCE RCTL"		# thumb keys, right hand
RPA="FN"			        # palm key, right hand

That’s it! Just a list of the keys in a sensible order. (The names used are X’s internal representation of the keys - I’ve provided a file containing an annotated list of them)

I have broken out a template file containing the above vector graphic outline and the placement of the internal scancodes (R0C0 etc), which is independent of firmware configuration. From this template, the layout config files as above, and X’s standard keymap library, we can produce layout diagrams showing how the keyboardio will behave under each combination of firmware and software key mappings.

TODO: handle multiple layers efficiently. Currently you have to define a separate config file for each layer…

1 Like