My Custom Keyboard Layout

Content

  1. Introduction
  2. Preliminary Thoughts
  3. First Layout
  4. Second Layout
  5. The Implementation
  6. Getting it to work
  7. Thanks to…
  8. Update 2010/08
  9. Update 2010/09

1. Introduction

When did you use “Ŋ” for the last time? On a german keyboard, you can access this character using AltGr+g. There are tons of other characters one rarely uses, at least when communicating in English and German and not some strange variant which requires stroked “l”s or “T”s (ł and Ŧ, btw). On the other hand, commonly used character such as { and } are put where they're really difficult to access – you have to press AltGr+7 or 0. The former requires two hands (at least on the Thinkpad x300), trying the latter you wish your hands were smaller. $ is another such char which every programmer and user of LaTeX regularly uses but at least I often hit the 3 instead of the 4, resulting in § instead of $.

2. Preliminary Thoughts

I'm quite used to the standard QWERTZ-layout which I therefor tried to conserve. Additionally, often used punctuation marks should remain at the same position, since I don't want to think about the keyboard layout when typing in a password (therefor, you'll rarely find z and y in my passwords, either).

OTOH, I wanted to move a few special keys to better positions (such as $, {, }, [ and ], as noted above) and I also wanted to have some (actually, nearly all) greek characters at hand as well. This made up for about 75% of the keys filled, which left me with quite some space to add exotic chars (I actually use) like ∇ (nabla, used for the gradient), ∀ (quantor, “for all”), ∃ (quantor, “exists”), ⇔ (“equivalent to”) etc.

3. First Layout

I didn't care much about how to get the layout into the computer but started with a first draft using a pencil and the printed-out image of a 104-keys keyboard. I quickly abandoned that and printed out another, 105-keys keyboard which then was filled with characters:

A keyboard layout, mostly like the standard QWERTZ-layout

4. Second Layout

As you can see above, there were still some blanks left to be filled in, and after some consideration, I did so:

A keyboard layout like the above but with extra characters

5. The Implementation

I decided to base my layout on the standard-german one and copied everything I was able to find about this layout in /usr/share/X11/xkb/symbols into one file, i. e. “de” and “latin”. Then, I started editing this file, and here is it's outcome: (Link to the file)

// Custom keymap by Claudius Hubig
// Mostly the same layout as QWERTZ/German, only the second,
// third and fourth level differs (sometimes)

default
// partial alphanumeric_keys
xkb_symbols "basic" {
  include "latin(type4)"
  include "kpdl(comma)"
  include "level3(ralt_switch)"

  name[Group1]="x2017";

  key <SPCE>	{[ space,	space,		space,			thinspace		]};

  key <LSGT>	{[ less,	greater,	bar,			brokenbar		]};
  key <AB01>	{[ y,		Y,		guillemotright,		U203A			]}; // half guillemotright
  key <AB02>	{[ x,		X,		guillemotleft,		U2039 			]}; // half guillemotleft
  key <AB03>	{[ c,		C,		doublelowquotemark,	singlelowquotemark	]};
  key <AB04>	{[ v,  		V, 		leftdoublequotemark, 	leftsinglequotemark 	]};
  key <AB05>	{[ b,  		B, 		rightdoublequotemark, 	rightsinglequotemark 	]};
  key <AB06>	{[ n,  		N,		Greek_nu,		U2115	 		]}; // natural numbers
  key <AB07>	{[ m,		M,		Greek_mu, 		U211D			]}; // real numbers
  key <AB08>	{[ comma, 	semicolon, 	U00B7,		 	multiply 		]};
  key <AB09>	{[ period,	colon,		U2026,			division		]}; // ldots
  key <AB10>	{[ minus, 	underscore,  	endash,			emdash			]};

  key <AC01>	{[ a,		A,		Greek_alpha,		sterling		]};
  key <AC02>	{[ s,		S, 		ssharp,			Greek_SIGMA		]};
  key <AC03>	{[ d, 		D,		Greek_delta,		Greek_DELTA		]};
  key <AC04>	{[ f, 		F,		Greek_theta,		notsign			]};
  key <AC05>	{[ g,		G,		Greek_gamma,		Greek_GAMMA		]};
  key <AC06>	{[ h,		H,		Greek_eta,		Greek_phi		]};
  key <AC07>	{[ j,		J,		numbersign,		U2203			]}; // exists
  key <AC08>	{[ k, 		K,		Greek_kappa,		Greek_beta		]};
  key <AC09>	{[ l, 		L,		Greek_lambda,		Greek_LAMBDA		]};
  key <AC10>	{[ odiaeresis, 	Odiaeresis,	Greek_xi,		Greek_XI		]};
  key <AC11>	{[ adiaeresis,	Adiaeresis,	Greek_psi,		Greek_PSI		]};
  key <BKSL>	{[ braceleft,	braceright,	U2227,			U2228			]}; // wedge, vee

  key <AD01>	{[ q,		Q,		at,			partialderivative	]};
  key <AD02>	{[ w, 		W, 		Greek_omega,		Greek_OMEGA		]};
  key <AD03>	{[ e,		E,		EuroSign,		Greek_epsilon		]};
  key <AD04>	{[ r,		R,		Greek_rho,		registered		]};
  key <AD05>	{[ t,		T,		Greek_tau,		trademark		]};
  key <AD06>	{[ z,		Z,		Greek_zeta,		Greek_PHI		]};
  key <AD07>	{[ u,		U,		U2019,			yen			]}; // real apostrophe
  key <AD08>	{[ i,		I,		Greek_iota,		U2102			]}; // complex numbers
  key <AD09>	{[ o,		O,		asciicircum,		Greek_sigma		]};
  key <AD10>	{[ p,		P,		Greek_pi,		Greek_PI		]};
  key <AD11>	{[ udiaeresis,	Udiaeresis,	exclamdown,		questiondown		]};
  key <AD12>	{[ plus,	asterisk,	dead_tilde,		nobreakspace		]};

  key <TLDE>	{[ dollar,	degree,		dead_circumflex, 	U2207			]}; // nabla
  key <AE01>	{[ 1,		exclam, 	onesuperior,		dead_acute		]};
  key <AE02>	{[ 2, 		quotedbl,	twosuperior,		dead_grave		]};
  key <AE03>	{[ 3,		section,	threesuperior,		U2282			]}; // subset
  key <AE04>	{[ 4,		apostrophe,	lessthanequal,		copyright		]};
  key <AE05>	{[ 5,		percent,	greaterthanequal,	U2208			]}; // element of
  key <AE06>	{[ 6,		ampersand,	U21D2,			U21D4			]}; // Rightarrow & Leftrightarrow
  key <AE07>	{[ 7,		slash,		U21D0,			leftarrow		]}; // Leftarrow
  key <AE08>	{[ 8,		parenleft,	downarrow,		uparrow			]};
  key <AE09>	{[ 9,		parenright,	U204F,			rightarrow		]};
  key <AE10>	{[ 0,		equal,		onehalf,		onequarter		]};
  key <AE11>	{[ backslash,	U003F,		onethird,		U2155			]}; // one fifth
  key <AE12>	{[ bracketleft, bracketright,	plusminus, 		U2200			]}; // forall
};

6. Getting it to work

After this, I had to copy the file to /usr/share/X11/xkb/symbols/ and tested it with “setxkbmap x2017” which worked just fine. Unfortunately, Gnome didn't find it yet despite various attempts to put it in /etc/X11/xkb/symbols/, to adjust the xorg.xml and xorg.lst in these directories etc. I finally hijacked another layout by deleting it in /usr/share/X11/xkb/symbols/ and creating a symlink with its name to my layout. I then was able to find my layout in gnome-keyboard-properties which gave me this lovely image:

A rendered image of my layout

7. Thanks to…

VIII. Update 2010/08

The image below shows the current layout – I added Return to the windows key and modified the image generated by gnome-keyboard-properties slightly to better reflect the actual layout.

A rendered image of the new layout with “Return” on the only windows key I have.

I also found out that customizing one’s keyboard layout is also possible in Windows! :) Using the Microsoft Keyboard Layout Creator I “ported” my layout to Windows XP (for use in a virtual machine…). Since that tiny little program also allowed me to build installers for my layout, I did so. I then packed all the files remotely related to the layout into a zip file of awesomeness you can download. Of course, running any of these installers is completely up to you and I’m not responsible for any damage you do to your computer!

IX. Update 2010/09

I finally got around and “ported” my layout to the console. The result is accessible here: claudius.kmap. You can load it with loadkeys claudius after moving it in an appropriate directory (such as /usr/share/keymaps/i386/qwertz). To set it as a default, edit /etc/default/keyboard. Unfortunately, not all signs are available in the virtual terminal because the fonts used are limited to 256 or 512 glyphs which is obviously not enough. Sorry.

X. Update 2011/08

There were some minor updates to the layout, but the links given above to x2017 (XKB file) and claudius.kmap still work. I moved ‘/’ to the key left from ‘y’, ‘|’ to Shift+3 and ‘&’ to Shift+7. Editing HTML is quite a mess now – calling the key left from ‘y’ X, to get </a>, I have to do Shift+X, X, a, AltGr+X – but I have / easily accessible :)