swanrad.ch

an X11 keyboard layout for scholars of old germanic

Update 23. April 2020: I made a slightly updated version of the keyboard layout, which is now at version 0.6. This post has been updated accordingly.

As a historical linguist dealing with Old Germanic languages, I need a convenient way to input special characters on my computer. Since I want to be able to use these characters across all my applications (text editor, office suite, e-mail-client, browser), a per-application solution is not a good idea. A better approach is to change the keyboard layout system wide. luckily, this can be achieved easily on a Linux system by customizing one of the predefined X11 keyboard layouts. In my case, I came to the conclusion that it was best to modify the existing keyboard layout definition for us-english (called “us”) by adding a new layout variant, which I decided to call “altgr-gmc”. As you can see, every key is bound to four different characters. The characters on the right side of every key can be accessed by using AltGr (bottom right) and AltGr+SHIFT (top right) as modifiers.

Here’s what I came up with (click for a larger image):
altgr-gmc keyboard layout

The distribution of characters across the keyboard is somewhat arbitrary, though I tried to keep compatibility to “altgr-intl” if possible, and strived to make the rest as intuitive as possible (r-sounds on the r-button, combining diacritical mark for a stroke below on the hyphen-button, since it sort of looks like a little rotated hyphen etc.).

If you want to give it a try, follow these instructions (root permissions required for all steps):

  1. Adding the new layout variant
    Open the file /usr/share/X11/xkb/symbols/us and append these lines at the end of it.
  2. Enabling it in X11
    Edit /usr/share/X11/xkb/rules/evdev.xml and add the following lines at a suitable position (e.g. after the entry for “altgr-intl”):

    <variant>
    	<configItem>
    		<name>altgr-gmc</name>
    		<description>for Old Germanic</description>
    		<languageList>
    			<iso639Id>eng</iso639Id>
    			<iso639Id>fra</iso639Id>
    			<iso639Id>ger</iso639Id>
    		</languageList>
    	</configItem>
    </variant>
    

    You may also want to make a corresponding change in /usr/share/X11/xkb/rules/evdev.lst for consistency’s sake (it doesn’t seem to be required).

  3. Setting it as system default
    Open /etc/default/keyboard and set XKBVARIANT to "altgr-gmc". make sure that the variable XKBLAYOUT points to the file that you modified in step 1 ("us")
  4. Restart your computer

If you want this to take effect immediately, load it up like this: setxkbmap us -variant altgr-gmc.

Note: I am aware that this is actually not a clean way of doing things on a Debian/Ubuntu system, as we are not supposed to tinker with files in /usr manually. The problem is that when you make a manual change there, it may get overwritten when you install upgrades (specifically of the xkb-data package). But it works as a “quick&dirty” solution and as long as you don’t mind making this change again after a dist-upgrade, you will be fine.

A few problems remain, mostly related to the handling of combining diacritical marks. Contrary to my initial plans, I ended up refraining from the use of “dead keys” in favour of using combining diacritical marks throughout. this happened for consistency’s sake. in general, I prefer to use precomposed characters (which is what the “dead keys” give you), but since precomposed characters are not available for all the desired combinations, it’s unavoidable to use combining diacritical marks in some cases, and because of that it seemed better to me to use the latter throughout. Of course it would be best to have a fall back strategy, so that precomposed characters will be used whenever possible, and combining diacritical marks elsewhere. Such a solution doesn’t seem possible currently, however, since you can only use a key either as a “dead key” (which will give you no character at all in the case that you choose an unavailable combination) or to have it produce a combining diacritical mark.

A second thing that is unfortunate is that the handling of combining diacritical marks seems to be very inconsistent across applications and fonts. Strangely, changing the font of my text editor does not only change the way the marks are displayed in the editor window (sometimes combined, sometimes simply next to each other), but it can also (in some cases) change the order in which I need to input the base letter and the modifier: depending on the current font, I sometimes have to type the diacritical mark before and sometimes after the letter I want to modify…

Another issue is that stacking diacritical marks is messy. Often, the marks will end up being superimposed on each other instead of being stacked. It is basically a matter of trial and error to see what will work and what won’t :( (This is often an issue of the font itself).

So here’s a sample of what you can do with “altgr-gmc”, including some fancy (but not always neatly typeset) stacked diacritical marks:

altgr-gmc-sample

Links:
http://people.uleth.ca/~daniel.odonnell/Blog/custom-keyboard-in-linuxx11
https://folk.uib.no/hnooh/mufi/ Medieval Unicode Font Initiative
http://unicode.org/charts/
http://unicode-search.net
http://en.wikipedia.org/wiki/Unicode

2 Comments

  1. Congratulations!
    It’s a real break-through. The temptation of having the altgr-gmc layout made me part with my Windows, but it pays. Up to now I have used the Icl alphabet when I had to type OE and OIcl texts, so I could access the special characters (consisting of a single glyph) I needed directly from the keyboard. But when it came to the accented characters there’s no help for it.
    The altgr-gmc has no rival and the instructions are easy to follow.
    Heaps of thanks to the creator!

  2. Thank you so much. I am using a customized keyboard layout as well and this was real pain. Now I can comfortably use Ubuntu.

2 Pingbacks

  1. bialyfamily.com » Polskie znaki na klawiaturze UK w Ubuntu
  2. Tweets that mention doink.ch » an X11 keyboard layout for scholars of old germanic -- Topsy.com

Leave a Reply