Ideally, I'm looking for a GUI tool, maybe a web application, but good documentation on creating a text definition for a keyboard layout would be great too. What is the normal procedure here?
In this question, the asker already decided on using "setxkbmap". Is this the recommended way? Can I add the layout to eg a git repo so I can make changes to it over time if I need to?
Best Answer
You can edit keymaps with XKeyCaps. On the upside, XKeyCaps is a GUI and it's very mature. A downside of XKeyCaps is that it's only a front-end to the old-style X window keymap interface, xmodmap, and not the modern interface, XKB.
It's perfectly fine to use xmodmap if you want, but it isn't as powerful as XKB. XKB features that xmodmap lack include:
Lock
(that's how X11 spells Caps Lock), but not CapsLock itself. Another thing xmodmap can't do is to have different sets of modifiers influence different keys, for example to have Shift and AltGr affect printable characters but Ctrl and Alt affect function keys.Menu
, and for the key codes of a Sun 5 keyboard”), but you wouldn't care since you're making your own layout.There are a few XKB GUI editors on the web, but all the ones I can find are projects that were quickly abandoned and aren't as easy to install as XKeyCaps. I can't find one with an Ubuntu package, for instance.
If you decide to write the keymap manually, the advantage of xmodmap is that it's very simple. You can read the man page, maybe look at an example, and you'll quickly understand everything except the subtlety of modifiers. If you can't figure out how to do it with xmodmap, it's probably impossible. The advantage of XKB, once again, is that it's more powerful. The downsides of XKB are that it's complex and poorly documented. Some suggested reading if you want to go this route:
xkbcomp -a :0 current.xkb
dumps your current layout to a file.Whichever way you choose, the keymap source is a text file or a collection of text files which works well with version control.