💾 Archived View for zaibatsu.circumlunar.space › ~solderpunk › phlog › keyboard-hegemony.txt captured on 2023-01-29 at 16:06:12.

View Raw

More Information

⬅️ Previous capture (2020-09-24)

➡️ Next capture (2023-03-20)

-=-=-=-=-=-=-

Keyboard hegemony
-----------------

In Australia, the standard computer keyboard layout is the US layout.
On the face of it, this is a bit odd, given our older and stronger
ties to the UK, who have a layout of their own.  My guess is the
underlying cause is currency.  The Australian pound was replaced
by the Australian dollar in 1966, well before the arrival of PCs,
and so when the time came a keyboard which made it quick and easy
to type $ would have been seen as a lot more useful than one which
made it quick and easy to type £.  Anyway, suffice it to say, the
US keyboard is what I grew up with.  It's what I learned to use
unix on, it's what I learned to program with, and I have decades
of muscle memory for it.

My first serious encounter with a different keyboard was when I
moved to Finland, where the layout was considerably different.
The familiar QWERTY layout of the unaccented Latin characters is
exactly the same, thank goodness, but in order to accommodate just
three additional characters - ä, ö and å - significant changes have
been made in the region to the immediate right of the QWERTY block,
which is of course an extremely important area for programmers,
being home to {, }, [, ], ;, :, ', ", <, >, / and ?.

I ended up more or less dodging this issue in Finland.  I didn't
want to just remap my keyboard to a US layout, as I wanted to make
an effort to learn some Finnish and hence having quick and easy
access to ä and ö was important (å is only needed for Swedish,
an official language of Finland but not one I had any interest in at
the time).  What ended up saving me was that my workplace gave me a
Windows machine, and so in order to be even remotely productive at
the more technical parts of my job I setup a VirtualBox VM running
Debian, and set *that* up with a US mapping.  So I got the US mapping
for coding and command line work, but the Finnish mapping for email,
web and office stuff.  A nice compromise and I didn't really have
to confront the issue at all.

Now that I am in Sweden, the keyboard layout is unsurprisingly
exactly the same, but something else has changed: I'm allowed
to use Linux at work.  Hurray!  I installed Lubuntu and regret it
tremendously, but I'll save that rant for another time.  The problem
is that without my little VM isolation chamber, I'm using the
Finnish/Swedish keyboard layout (is this a pan-Nordic layout?
Maybe, although I don't see how to get a ø...) for everything.
I'm sure I probably could configure some kind of keyboard shortcut
to quickly switch between two mappings, but I suspect this would
just be more trouble than it's worth, as I would constantly be
forgetting which mode I was in, stopping and starting all the time.
So, I just decided to make a concerted effort to learn to code on
this new keyboard.  Of course, my personal machine at home has a US
layout which is what I use for all my personal projects, so I was,
in fact, aspiring to become in some sense "ambidextrous", which is
fairly ambitious.

Frankly, I'm hating it!  It's not *just* a matter of having to
relearn where particular keys are, the problems are far deeper than
that.  Early on in the miserable process I found myself thinking
things like "this layout is objectively inferior!", but of course
that's not true.  Well, actually, maybe I still believe there's a
grain of truth in there.  But the real situation is not that the US
layout is "good" in some way and the Nordic, or whatever, layout is
"bad".  It is, of course, that unix, and all its shells, and C,
and regular expression syntax, and HTML and so many other things,
were all designed by people who happened to be using the US layout.
This presumably influenced their decisions of which characters
to use for certain purposes, and those decisions have then been
inherited by huge additional swathes of software, e.g. by all the
many programming languages which use "C syntax".  The frustrations
I've been having are the inevitable result of a mismatch between an
aspect of my reality and the assumptions of the people who designed
the tools I'm trying to use.  Having realised this inescapable truth,
I kind of wonder - *do* non-US-layout-native developers typically
switch their layout when coding?  Or do they actually just put up
with stuff like what I'm about to describe...

The biggest issue, by far, is with characters like ~, ^, `, '.  On a
US layout, these work very simply - you press, e.g., the ^ key and
a ^ appears and that's that.  Presumably this mimics the way they
worked on mechanical typewriters, where to type, e.g. an ñ you'd
type an n, then backspace (which of course didn't *delete* the n, but
merely shifted the carriage back to put your n into striking position
again), then a ~.  In the English-speaking world, where things like
ñ are exotic oddities, this makes sense and as a result all those
characters are quick and easy things to use as arbitrary symbols for
things like denoting your home directory, or requiring that a regular
expression matches the beginning of a string, etc.  But in places
where those characters are an actual part of everyday language,
having them work this way isn't really practical.  On the Nordic
layout (and I assume this is common to all European layouts, since
you don't actually need this mechanism for any Nordic language)
when you press the ~ key, nothing appears on the screen at all, but
when you subsequently press, say, the n key, you get an ñ.  The ~
functions as a combining character, like on a typewriter but you
don't have to do the backspace in between for things to line up.
In order to actually type *just* a ~, you have to press the ~
key and then the spacebar, so that it "combines with emptiness"
(at least, this is how I've been doing it).  This means that all
those characters which were just random, convenient single keystroke
symbols from the US point of view are actually two keystroke symbols.
A ``` "code fence" like in Markdown, or Gemtext requires *six*
keystrokes, alternating each time between needing a shift key
and not!  This is way more cumbersome.  It gets even worse if you
want to follow the ``` up with something between {}s because...
...the second biggest issue is with how brackets are handled.
I mean brackets in the most generic sense, i.e. including all of
(), {}, [] and <>.  First we need a bit of a digression, though,
to introduce the existence of two different Alt keys.  The US
layout has two Alt keys, functionally identical, on either side of
the spacebar.  The Nordic layout instead has the familiar Alt to
the left of the spacebar, but to the right we find its grumpier,
non-interchangeable cousin "Alt Gr".  I don't know what the "Gr"
stands for.  In my inner monologue, this key is "Alt Grrr", hence
"grumpier cousin".  This key acts as a kind of "alternative shift",
to facilitate heavy overloading of keys.  For example, and bringing
us back to the subject of brackets, the 8 and 9 keys, when combined
with shift, will produce ( and ) (frustratingly shifted one position
left from the US layout, where 9 and 0 do this, but oh well),
but when combined with the Angry Alt will instead produce [ and ].
This is just the first, and actually least annoying, instance of
my big struggle with brackets on this layout, which is a complete
lack of consistency.  On the US keyboard, corresponding pairs of
brackets are *always* immediately horizontally adjacent, and with
the exception of [ and ], which are their own keys, *always* need
a shift key.  In this setup it's very easy to type an opening and
closing bracket in immediate succession, which is a handy habit
many developers have acquired.  On the Nordic layout, () and []
are adjacent pairs, but one requires shift, and the other Alt Gr,
{ and } require shift, but are *not* adjacent - { is on 7 and }
is on 0 - and, the pièce de résistance - < and > are on the *same
physical key*, which produces < when used without shift and > when
used with it.  There is literally no aspect of your hand position
or movement which remains constant across all possible opening and
closing pairs of brackets!

Actually, Alt Gr causes quite a lot of problems, even when not
coding.  In most web browsers you can use Alt in conjunction with
the left and right arrow keys to go back and forward, respectively,
through your browser's history.  With an Alt key on the right hand
side of the spacebar, this is a very easy, natural, one-handed
operation.  But with only a single Alt on the left hand side of
the spacebar, this is impossible to do with one hand.  And the
old muscle memory is dangerous here on Windows!  There Alt Gr
plus arrow keys serves to rotate the display 90 degrees, either
counterclockwise or clockwise - I am astonished both that such an
obscure and surely very rarely needed operation is mapped to such
a convenient and easy to accidentally trigger key combination,
and at how it seems to temporarily bring a machine to its knees
with intense load for a few seconds.

I am sure all of this would eventually become second nature, but
it's such a more complicated undertaking than I imagined that I'm
no longer convinced becoming "ambidextrous" in this way is worth
the effort.  It's not a case of becoming equally skilled at two
arbitrary but equally functional ways of doing something - it's
a matter of becoming equally skilled at using one tool designed
for the task at hand (actually, interestingly, here the *task* was
designed to fit the tool!) and one tool designed for an entirely
different task.  Why bother?

Anyway, I went to the trouble of writing all this up not to make fun
of a particular keyboard layout (although, really, < and > on the
same key?!), but because I thought it was an interesting example of
implicit, unquestioned cultural assumptions influencing technical
design decisions which eventually become widespread outside of
their originating cultural sphere, which seems like a good thing
to be aware of in general.  I also just never realised how deeply
and directly ingrained the US origin of most of modern computing
is in details like this until I started thinking about why coding
on a non-US keyboard sucked so badly.  Perhaps it shouldn't be,
but it was kind of shocking for me to realise that the only reason
we use $ not just to talk about money but as a prefix for shell
variables or in regular expressions, but never use £ or ¥ to
talk about anything other than money is simply because of where
the relevant technologies were developed!  In an alternate history,
it could be the other way around...