9 minutes
Creating an optimized keyboard layout for the next generation of the Datahand
Ever seen this keyboard? This was called the Datahand, it was a radical new approach to keyboards that mostly only existed within a small community of RSI sufferers. It cost $2,000 in 1993, which is north of $4,000 today, so you really had to need this thing to justify the price. Even now there’s a small community that continues to use these.
For a long time after Datahand shut down production, there was no real replacement. Then Morgan Venable, alias Claussen, created Svalboard. It’s a modern take on the same formula, created by a consumer electronics professional whose career was saved by the Datahand decades ago. In fact, the creator of Datahand even uses a Svalboard nowadays!
I’m a keyboard nerd – a custom layout on the Chocofi has been my daily driver for the past couple years, which I can reach 150wpm on, but more importantly programming feels like a breeze. But there’s always room for improvement, and from everything I’ve seen about Svalboard, I think it’s the next step.
You know what would make this easier to learn? Putting a totally novel layout on it
You can absolutely just migrate your existing layout to Svalboard almost 1 for 1, and get up and running right away. Reasonable people would do this. But there’s something wrong with my brain regarding keyboards. I need them to be optimized. I’m spending half my life on these things, which makes it impossible to justify anything that I know is suboptimal.
So why don’t I just translate my existing layout? Well because it’s optimized for a standard-ish keyboard, and that optimization really doesn’t translate that well to a Svalboard. It would still be vastly better than ex. qwerty, but I’d know I’m leaving something on the table (but not my keyboard, get a keyboard tray or arms).
How to generate a keyboard layout, in general
You can generate a keyboard layout manually, and that’s how a lot of keyboard layouts have been generated. But it turns out that keyboard layout generation is an extremely tricky optimization problem. Here’s an incomplete list of things you may want to optimize for:
- Hand balance – You probably don’t want one hand to be doing significantly more work than another
- Finger balance – Same thing, you probably don’t want a single finger responsible for hitting 25% of keys. But you don’t want this to be totally even either – naturally your index finger should be doing more work than your pinky.
- Key costs – You want to assign the more common letters to keys that are easy to hit.
- Single finger bigrams – You want to minimize the amount you’ll be using the same finger for two keys in a row.
- Finger movement patterns It’s easier to “roll” inwards for most people, meaning hitting two letters where the first one is using a finger that’s further toward the outer edge of the keyboard, and the second finger is closer to your thumb. Outward rolls, all else being equal, should be avoided.
This is already a ton to consider when manually moving around keys, and the local maxima you could find by swapping around keys doesn’t come close to the global maxima possible.
So what I’m using is a tool that can automatically calculate the cost of all these things, and optimize over that using a genetic algorithm to generate keyboard layouts. All I have to do is give it the parameters of my keyboard and usage patterns. I can say I care a lot about reducing outward rolls, or that I want to barely use my pinky, and it will go off and test millions of keyboard layouts for me. I’ve forked it here, and added a whole bunch of Svalboard-specific stuff.
Taking it from the top: key costs
The main thing to consider, and pretty much the only thing that was considered for layouts like Dvorak, is minimizing the cost of the keys you hit. “e” should be very easy to hit and “q” should be in some neglected, distant part of your keyboard (some people don’t even put it on their base layer (it’s me, I’m some people)).
Here’s a Svalboard finger cluster for the left hand. N is for North, C is for Center, S is for South, O is for outward, and I is for inward. O and I would be flipped for the right hand.
So, what do key costs look like on something like this? It’s going to vary per-person significantly, but the general idea is:
- South and Center keys are both really nice to hit, some people somewhat prefer South keys
- Side note: this is awesome, because it’s like having two home rows. Vim users salivating right now.
- Inward laterals are good after a short acclimation period - ex. moving your left index finger to the right
- North keys are the next most preferred, stretching is generally harder than curling, and it’s somewhat odd to hit something with your nail
- Outward laterals are of the devil – go ahead, compare pulling your ring finger like on a trigger, versus moving it outward toward your pinky. You want zero keys on this movement.
- The exceptions to this are the pinkies, which despite generally being subpar digits, can move outwards more comfortably
I’m exaggerating the “badness” of all of these. Svalboard finger clusters require such tiny movements to activate the keys, so don’t get scared off of the keyboard because it sounds like the keys are terrible to hit – they’re all better than hitting a key that’s not directly under your finger on a normal keyboard.
So here’s a proposed effort mapping for one finger cluster. This doesn’t tell the whole story, because I’ve actually tuned each finger cluster individually (again, my brain is broken when it comes to keyboards), but something like this is roughly right.
Our starting point: QWERTY
It feels wrong to start with anything but good ol’ QWERTY, so let’s see how it performs on the Svalboard.
Here’s the abomination in case you needed reminding, which has only been altered slightly for the Svalboard.
Of the top 6 english letters, which make up 50% of usage, how many are on “good keys”?
One, and it’s barely passing (it’s on a pinky center key). So qwerty is terrible but that’s not news. Let’s run our optimizer for the first time and see what it gives us.
Much better. Our most common letters are on the two best rows (center keys and south keys), as well as a thumb key (I’m putting one alpha key on a thumb).
Finger balancing
Let’s just see how balanced the fingers are… Ah shit.
Turns out my right index finger is doing almost a quarter of the work. That’s not gonna be good after 8 hours of typing. So let’s tell the optimizer that we care about finger balance, and particularly that we want the loads to be roughly distributed like so:
intended_loads:
[Left, Pinky]: 1.2
[Left, Ring]: 1.4
[Left, Middle]: 2.0
[Left, Index]: 2.0
[Left, Thumb]: 2.0
...same for right hand...
Re-running optimizer…
Finger balance is almost ideal, and key costs barely went up, good stuff.
Single finger bigrams
Single finger bigrams are so scary to autists keyboard-layout people, that they call them SFBs instead, like wizards in Harry Potter avoiding the name of the dark lord. SFBs are the worst, with no redeeming qualities. But the Svalboard is alien technology from the future, and has redeemed SFBs just a bit. Turns out, rolling a single finger from the center key to the south key is actually really nice, and rolling from center to an inward lateral is pretty fine too. On the other hand, inward-center is terrible, south-north feels like crossing a vast chasm, and inward-outward is unspeakable.
So, we can’t just say “SFBs bad”. I tested a bunch of different SFBs on all my fingers, and came up with an effort rating for each of them.
First off let’s see how our current layout does with this new metric:
Bigram metrics:
Finger Repeats | Worst: th (36.26%), ll ( 8.73%), di ( 7.64%)
Look there, “th”, the most common bigram in the English language, is a south-center SFB, that’s not something to be enthusiastic about (“th” used 7 times in this sentence).
Re-running optimizer…
Nice. No bad frequent SFBs any more, and we ended up with some nice center-south (“ue”, “rl”, “ds”) rolls as well. Of course, you can find words with bad SFBs, like KOala, or vieWPoint, but we’d have to redesign English to get rid of bad SFBs entirely.
Movement patterns between fingers
It’s hard on a keyboard to go from ex. a ring finger to a pinky finger, which is an outward roll from a weak finger to a weaker finger. It’s easier to go from a middle finger to an index finger. You can come up with a cost for each finger combination.
So let’s add a metric that punishes bigrams which have uncomfortable movement patterns.Here’s what our new metric thinks about our current layout:
Bigram metrics:
Movement Pattern | Worst: on (15.71%), ic ( 9.70%), of ( 8.61%), fo (5.88%)
Four common English bigrams, all pinky-to-ring or ring-to-pinky.
Re-running optimizer…
We still have good finger balance, key costs are low, no bad bigrams, and very few bad movement patterns. There will always be some bigrams showing up on these lists, but the total cost of bad movement patterns has gone down by 70%.
The final result
I added some more metrics to optimize for, which I won’t bore you with, and they’re really quite minor, and this is what I’ve ended up with. It’s the perfect layout for me. I’m not that much of a special case, my preferences have lined up pretty much with what other Svalboard users say, but no one will agree with every single parameter I’ve set for this algorithm, or how much weight I’ve given each metric.
In terms of actually using the layout, I’m still in the learning phase, and barely hitting 30wpm. Past results indicate it’ll take me a week or two to become productive, then a long tail where I stop deliberately practicing, and improvement comes slower. But I’ve now reached 150wpm on 3 different layouts, so I trust this one will get there too – actually, I’m harboring some hope that I can blow past that, I really do think that the Svalboard has something special going for it.
If you play games, my PSN is mbuffett, always looking for fun people to play with.
If you're into chess, I've made a repertoire builder. It uses statistics from hundreds of millions of games at your level to find the gaps in your repertoire, and uses spaced repetition to quiz you on them.
If you want to support me, you can buy me a coffee.