My Keyboard Layout
This post documents my keyboard layout.
Disclaimer: My layout is super weird, so I don’t expect anyone else to use this out of the box. However, I will cover some ergonomic discussion, which hopefully could evoke some new idea for the readers.
§My Keyboard Layout
§Alphabet Layout
I use colemak layout. Did the switch in 2013, and have been using it since. Was it worth it? I don’t know. Try it for yourself.
§UK layout + ZXCB Shift
The physical keyboard layout is UK layout, where there’s one extra key next to the left SHIFT key. (Depending on the
language®ion a keyboard is designed for, the symbols on it might differ. Mine, bought in Germany, shows “><”. In the
standard US layout, the key next to the left Shift
is Z
.) The reason for that is when I place my hands on the
keyboard, there’s a natural angle formed between my arms, in a shape of an inverted V
. Therefore, when I curl my
fingers, they move towards bottom-left and bottom-right, respectively; IOW, the horizontal components of the moving
vector are in opposite direction. However, if you look at the alphabet area in a keyboard, you will notice it’s leaned
towards left, kind of like \
. Having one extra key between left SHIFT and Z
remedies this problem to some extent,
because we could remap extra key + ZXCV
to ZXCVB
. The original B
is a bit hard to reach, so one can definitely
just ignore it. However, since <BackSpace>
is even harder to reach, I remapped B
to <BackSpace>
, which is
semantically reasonable.
§Control the Control
I have been using Linux for around a decade, and done the swap between Capslock
and Ctrl
almost from day 0 as
instructed in blogs floating around in the community. Roughly in the mid of 2014, I started using Mac for mostly
entertaining use, while sshing to my Linux box for programming related tasks. One thing I like the most about Mac is the
Cmd
key, which more or less is like Ctrl
in Linux. Since it’s located next to space
, I hit it using my thumb,
which feels much more natural than using my pinky. Since it’s a modifier key, it’s only used together with another key.
Such feeling becomes more obvious. Try hitting the corresponding key combination while performing the same tasks on
Linux vs Mac (such as ctrl-w
vs cmd-w
for closing a tab, ctrl-cxv
vs cmd-cxv
for basic editing).
§Return of the Return
Inspired by the same reasoning, I also fiddled the right cmd
so that my right thumb would not lie around idle. It’s
mapped to Return
, as it’s probably the most significant key in daily CLI use.
§Tools
Various tools used to achieve above under different OS.
§Linux
Using the Mac magic keyboard:
1 | $ setxkbmap -model apple -layout us -variant colemak |
The content of .Xmodmap
:
1 | ! the physical keys on my magic keyboard |
§Mac
I use Karabiner for remapping certain alphabet keys, and the built-in iTerm2 support for remapping modifier keys as I ssh into my Linux. All this can be done using the GUI; no scripts involved.
§Windows
I use sharpkeys for fiddling with win
key and alt
keys, and
autohotkey for getting colemak with ZXC
shift.
The AHK script is shown below:
1 | ; Colemak layout for AutoHotkey from UK layout |