Kristoffer Grönlund

ziran.se

This is a quick follow up to my previous essay about designing my own keyboard layout.

For reference, this is the layout I am currently using:

w c m g p  q y o u '
r s n t v  k h e i a
z x l d b  j f / . ,

Multiple people from the kodsnack slack channel suggested that I refer to it as kheia, so unless I decide to re-shuffle the right hand home row, that's the name I am going to use.

Anyway, I thought I would talk a little about the design decisions that went into this layout and why I made certain choices. I'll also mention some of the problems that this layout has that I may or may not be able to resolve.

I had previously settled on learning the hands down reference layout which looks like this:

q c h p v   k y o j /
r s n t g   w u e i a
x m l d b   z f ' , .

Alan Reiser (designer of the hands down series of layouts) no longer recommends this one, but I found it to work really well for me with one minor modification: Switching K and Y to get K into a more convenient location for Swedish. I worked on learning this layout and got to decent speeds for english text, and was even able to use it for programming without too many issues.

It did have some problems that bothered me, however. Maybe the most obvious one is that Alan himself no longer recommends learning this layout. I did look at his newer layouts and while none of them seemed quite right for me, I ended up heavily influenced by the hands right neu layout:

w f m p v   / . q " ' z
r s n t b   , a e i h j
x c l d g   - u o y k   

As you can see, the hands right neu layout makes use of extra columns to the right of the standard 30 key grid for alphabetical letters, and with a keyboard like the Ferris Sweep, I don't even have these keys and would need to move z and j to separate layers or start messing with the layout. This made neu a non-starter for me, especially considering that j in particular gets heavy use while coding in vim.

I was really happy with the home row of reference; meaning rsnt on the left hand and ueia on the right hand, except for one thing: with u under the right index finger I would end up occasionally hitting that key by mistake, and in vim, u is undo. This kept messing me up, enough that I decided that I wanted something else in that location. So as a start to my layout I basically took the left hand of reference and right hand of neu and rearranged neu to spell heia, while also flipping the punctuation back to the lower row.

Eventually, I ended up with this first version of what I called the cmpneu layout:

q c m p b z y o u /
r s n t g j h e i a
w f l d v x k ' . ,

(the very first version had q and / swapped, but I reverted to the above after some feedback).

I used this layout for a while, until two things started bothering me: w on the lower pinky and f on lower ring. Trying to improve on those with hints from other layouts like APTv3 led me to the layout presented above. j is now in a worse spot (the n position of qwerty) and k has moved up to take the inner home row position, but I decided that this actually wasn't too bad and in return I was able to improve the w and f positions. Of course things may still change...

Some general thoughts on letter positions and constraints, and possible future improvements:

  • On the home row pinky, it is best to place a key which is usually not repeated (a or i is a good choice since aa and ii are unusual, same for h and hh). Many other layouts end up with N on the left hand pinky (see below) but this would probably be a poor choice for Swedish. However, I currently have R on left hand pinky which is also not great. the canary layout fixes this by having c on left pinky and a on the right, but is notoriously bad for vim usage and thus also probably not great for Swedish.

  • N on left hand pinky and H on right hand pinky provide nice in-rolls since N is commonly followed by another consonant while H is almost always followed by a vowel.

  • Spelling YOU on the right hand top row is suboptimal, since this makes YOU and OU out-rolls instead of in-rolls. APTv3 has UOY on the top row but ends up with Y on the top pinky position which doesn't seem great. Hands down neu manages to provide the UOY in-roll but I didn't manage to preserve this without making the K and J positions significantly worse.

  • Moving / to the qwerty , position makes sense for someone who writes a lot of C++, since the qwerty position results in a lot of doubled pinky taps (// is the comment prefix for C++).

I'm currently experimenting with making modifications to canary to see if I can make it more amenable to vim without losing too much of its strengths, but so far I haven't been successful enough to abandon kheia.

Here is my modded canary as it stands right now:

w l y p b z f o u '
c r s t k m n e i a
v x g d j q h ; . ,

My current obsession with alternative keyboard layouts started, strangely enough, by reading an article about optimising the symbol layer of a keyboard running qmk.

For those who don't know, there is a whole world of custom-built mechanical keyboards running open source firmware (usually qmk or zmk, and a common feature of these keyboards is additional layers, enabled by holding down a key just like shift on a regular keyboard switches the keys from lowercase to uppercase letters.

Just like lowercase and uppercase, the number row on a regular keyboard turns into a row of symbols when the shift key is held.

Being able to configure new and customized “shift keys” is really useful if your keyboard has fewer keys than a standard keyboard. For example, on a keyboard without the number row, a “number” shift key could turn the top row of letters into numbers.

Why would you want fewer keys on a keyboard? More is more, right? Well, the answer generally is ergonomics (perhaps also, to some degree, aesthetics). The theory is that by not having to move the hands to reach distant keys, strain on the wrists and fingers is reduced.

It turns out, once you have the source code for your keyboard available, there really is no limit to what you can do. Why stop at adding new layers, when you can rethink the design of the keyboard from scratch?

(I have a ton of other custom keyboard modifications in my qmk fork).

This is not a new idea. In fact, redesigning the keyboard to reduce finger motion is the exact idea behind the Dvorak keyboard layout, designed in 1936.

The Dvorak layout does a number of things in order to improve the keyboard usage experience: First, it tries to move the most commonly used letters closer to the home row. The idea here is that since the fingers should rest on top of the middle row (asdf and jkl; on a standard QWERTY layout) in order to minimize the movement required to reach any key, a way to further reduce movement is to place the most commonly used letters right there.

The second thing that Dvorak does is move the vowels to one hand and most of the consonants to the other. This increases alternation between the hands, giving each hand more time to get into position before having to hit a key.

However, there are a couple of problems with the Dvorak layout which has led people to try to come up with better alternatives. Most notably, Dvorak places L in a position which is awkward to reach for most people, despite L being one of the most common letters in english.

Most famous of these is the Colemak layout, which manages both to be a well optimized layout while retaining a lot of similarities with QWERTY in order to keep commonly used shortcut keys like copy and paste in their original positions.

A common modification of Colemak is the Colemak-DH layout, which notes that it's generally more comfortable for the index finger to reach down to the bottom row than to stretch inwards to hit the QWERTY G or H positions. Therefore, it moves D and H to the index finger bottom row positions. This is generally considered a very good layout and the first layout to recommend to someone looking to get into alternative keyboard layouts.

In fact, there are a lot of variables that a keyboard layout can be optimized for, and some of them are contradictory to each other, making keyboard layout optimization a really fascinating problem. One observation is that by optimizing a layout for english, we may accidentally make it less optimal for a different language. For example, I type a lot in either english or swedish. Since these are related languages, the letter frequency is generally similar between the languages. However, some of the least common letters in english are some of the most common in swedish (notably K and J). I will get back to this issue later in this essay.

When looking at bigrams and trigrams – common sequences of two or three letters like HE or YOU – it gets even more complex. In fact, bigrams introduces some of the variables that a modern layout generally tries to optimize for beyond finger distance travelled:

  • SFB, or Same Finger Bigram: Having to use the same finger twice in a row, for example when typing DE or CE on a qwerty keyboard.
  • Having to stretch across all three rows as when typing CE can be considered a separate stat, commonly called Same Finger Skipgram or SFS.
  • LSB / LSS: Lateral Stretch Bigram / Skipgram. This refers to having to stretch adjacent fingers across rows, like typing BE on a QWERTY layout.

Another set of variables to optimize for relates to rolls and redirections. A roll is when a sequence of letters can be typed by “rolling” the fingers across the keyboard, as when typing WER on a QWERTY keyboard. Generally, inward rolls (from left to right on the left hand, or from right to left on the right hand) are considered more comfortable. Redirection happens when having to switch directions for a roll, for example when typing RET on a QWERTY keyboard.

All this is the background against which I decided to design my own keyboard layout.

I have based my design on some of the most modern and efficient designs out there, like Hands Down Neu, APTv3, Nerps and Semimak. My goal was to create a layout which works well not only for english, but for swedish, vim and programming in general as well.

Mainly, my problem with layouts purely optimized for english is the positions of J and K. As mentioned earlier, these letters are more common in Swedish. Another letter like this is V. (I am not going to mention the letters ÅÄÖ in this essay; for the purposes of this essay it can be assumed that these letters take the places of the ,./ keys on a QWERTY keyboard).

I am also an avid vim user and in vim, the J and K keys are used to move the cursor between rows. This means that a layout which optimizes for english text tends to make those motions less comfortable in vim.

After some iterations and a lot of trial and error, this is my current version of this layout:

w c m g p  q y o u '
r s n t v  k h e i a
z x l d b  j f / . ,

I have been calling it cmpneu or wmpneu, although that name fits less well now that I've rearranged the top row... so I'll try to come up with a better name at some point.

Here are some statistics for this layout generated by the a200 analysis software. It compares very well to other layouts optimized for english alone while still making K, J and V more comfortable for swedish and vim usage.

Trigrams
========
Alternates - Total: 25.64%
     Rolls - Total: 52.39%   In: 19.52%   Out: 32.87%   Ratio:   0.59
  Onehands - Total:  3.89%   In:  2.20%   Out:  1.69%   Ratio:   1.30
 Redirects - Total:  4.93%
   Unknown - Total:  0.00%

Same Finger
===========
       SFB - 1.09%         DSFB - 5.67%
       SFT - 0.00%          SFR - 6.37%

Finger Use
==========
      Left - Total: 38.92%   LP:  6.28%   LR:  6.48%   LM: 10.85%   LI: 15.30%
     Right - Total: 42.57%   RP:  7.87%   RR:  9.36%   RM: 16.30%   RI:  9.04%
     Thumb - Total: 18.50%

Row Use
=======
       Top - 25.17%         Home - 60.31%       Bottom - 14.52%

Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins as before. But the world does not need twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacture of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralising. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness.

  • Excerpt from: “In Praise of Idleness” by Bertrand Russell

Recently, I was consulting at a place which used CircleCI as part of its CI/CD setup and as part of working there I signed myself up to receive email from them. I’ve known about and used CircleCI in the past and knew it as a place which used clojure to build their product which I thought was quite interesting.

Read more...

15 minutes ago or so, I was casually browsing the XXIIVV wiki and the whole lofi/monochrome aesthetic got to me. Suddenly I wanted a desktop wallpaper featuring a monochrome, 2 color design. A simple dot pattern.

Read more...

I have been spending a lot of time on Mastodon lately.

Let me rephrase that. I have been spending a lot of time in the Fediverse lately. Or, should I say on ActivityPub? Anyway, my experience so far has been almost exclusively as a member of the fediverse via my single-user instance running Mastodon, although I am considering many other ActivityPub implementations as well.

An important aspect of the fediverse are the acts of federation and defederation, meaning the way in which different instances exchange information with each other and the level of control that instance administrators have over that process.

In Mastodon, it is possible to block or limit individual accounts on other instances, for example to mute posts from a given account for a time but still keep following them, or to block an account completely and attempt to stop them from following your account.

It is also possible to block on an instance level, both completely severing all contact as well as limiting posts originating from that instance.

Earlier today I got involved in a lot of debate around defederation, specifically regarding the mastodon.se instance and its moderation policies. For more back-story on this I recommend reading the sequence of posts by @Coeur66 that led to me limiting posts from mastodon.se.

In debating this topic, there is a point of view that keeps cropping up which I fundamentally disagree with, and feel like I need to address: The idea that defederation is an act of censorship, and that defederating from an instance is limiting the free speech of the accounts on that instance.

In my view, federation is a voluntary act. As an instance, we choose who we communicate with based on who they are and how they manage their communications in turn. Each instance is its own island, connected only by choice. That choice is the fundamental unit of freedom here, not the freedom of having unlimited means of communication. If an instance is managed poorly, or hosts accounts that harrass or otherwise trouble those of another instance, that instance should be defederated as a safety measure, until its mode of communication is deemed acceptable. Or not. Again, federation is voluntary and can be revoked for any reason.

In the fediverse, there is no central authority and no capacity for large scale content moderation in the same way that is performed by the large corporate social networks. Instead, there is a confederacy of free actors choosing to inter-communicate or not, based on whatever conditions suit each individual member. Participation in that confederacy is voluntary, and to act in a way that causes the other members of the federation to cease communications is an active choice.

We are reaching the end of 2022, and the time is ripe for an update from the Ziran headquarters.

For the last six months or so I have been deep in goblin mode.

I’ve planted a hazelnut tree.

I released two albums of music and a bunch of podcast episodes.

I had a baby.

I guess I could say that I am in stealth mode, doing R&D, that I’m on parental leave, or that I am working on several different projects at varying pace and intensity. All of which would be true. I just like goblins. The term does seem quite appropriate as I shuffle around the house in a hoodie and sweatpants, carrying bags of diapers.

My current plan for next year is to poke around in the garden, plant some seeds and see what might sprout. Figuratively and literally.

I hope that you have had a good year, and that 2023 will treat you kindly.

It’s December, and we are starting to feel the holiday spirit here at Ziran enterprises, inc. In order to properly celebrate the darkest season, I have set up a Spreadshirt shop with some random items to select from.

First and foremost is of course the 2022 holiday design:

…but of course there are also options for the Ornamental Hermits out there, as well as versions with the spaceman logo and others. I tend to come up with more or less brilliant shirt design ideas once in a while, so I’ll probably keep adding to the store continuously.

Shop link here. Enjoy!

It's exciting days on the internet as the Twitter failwhale finally seems to be falling for good, all thanks to the God Emperor of Mars and his magic sink.

Read more...

I’m Kristoffer, an independent software developer from the Swedish countryside currently working on various small applications while consulting, speaking about code and recording music.

My plan for this space is to write about topics that interest me, and that might be of interest to others. That means topics like small tech, sustainability, computer art and music production, the history of computer programming, colonialism and indigenous culture or black metal anarchism to mention a few.

Also, expect photos of cats.

Enter your email to subscribe to updates.