Efficient Thought-to-Screen Process: My Keyboard Optimization

Ahmad Baitalmal
HackerNoon.com

--

About 15 years ago I came to realize that computers were my career. That I will, for as far ahead as I can imagine, be working intimately with computers in one way or another. So it made sense to make the thought-to-screen process as seamless and as effortless as possible. I am now one of those Dvorak keyboard people you may have run into. But that was just one of the little efficiencies I invested in. I’ve also come up with a personal keyboard layout optimization. I’ve been thinking about sharing my keyboard navigation setup in an article or blog for sometime. I think I’ve benefited from my setup and I would like to share it in the hopes that it may help someone else.

The little nubs on the F and J keys on the Home Row

One valuable thing I learned from the vi and Dvorak crowd was how disruptive and inefficient moving your fingers off their natural resting pose on the keyboard is. The natural pose I’m referring to is what those little nubs on the F and J keys are there for. You rest both wrists at the keyboard and, with your index fingers, feel for the two nubs. Your other fingers rest naturally on that row of keys called the ‘home row’. Any action that requires you to break away from that pose is disruptive to your thought-to-screen process and therefore anti-productive. If you want to move the cursor up, down, left, or right, you have to stop thinking about what you are typing, divert attention to positioning your right hand on the arrow keys, do the movement, then re-position your hand back on the ‘home row’ and try to pickup from where you left off.

The ‘home row’ on a keyboard

I learned about the ‘home row’ when I was introduced to the Dvorak keyboard layout. But what really closed the loop for me was vi’s HJKL navigation. I’m not a vi user, but I found the idea that you would temporarily use home row keys to navigate around text brilliant. Breaking my pose and going to the the arrow keys was akin to severe sleep apnea for my thought-to-screen process; I was constantly being yanked out of concentration just to move the cursor. Then I would reposition my fingers and mentally go “now, where were we?…”

I started toying around with different ideas on Linux and the Gnome desktop. I had to patch GTK+ to get the the right keys to fire off the right events and that worked for a while. But I’ve since moved to using OS X (now macOS) so the following setup is for Mac, please feel free to share how you could do this on your favorite OS.

Caps Lock to Command and Command to Option

First off, I’m not sure why the largest key on our keyboards is usually the Caps Lock. I don’t think we use it frequently enough to justify its relative size. A key we use with way more frequency is the Command key. Luckily I think Apple has known that for some time so they made it easy to switch around those keys with ease. My Caps Lock is the Command key. And the actual Command is now another Option key. Nothing too fancy but the utility of this will become apparent very shortly.

Now the fun part. While I’m a Dvorak user, I’ll explain in terms of the usual Qwerty layout since Dvorak is an investment most people don’t usually go for so readily (I highly recommend checking out Dvzine if you are interested in Dvorak). As my right hand rested on the home row I began to imagine what would be my gut reaction to wanting the cursor on the screen to move about. I felt I just wanted to use the keys IK for up and down, and JL for left and right. But I needed a trigger to turn these keys into navigation mode. This is where the Option key came in. I couldn’t use the Command key, it was already used by many applications for functionality shortcuts.

What you can type with the Option key

The Option key, however, was a 2nd class citizen, especially on those mid-keyboard keys. It just spit out infrequently used symbols. But the most convincing reason was that my left thumb was sitting right on top of it. Just sitting there useless and under utilized. After much trial and error, it became apparent that the the newly created Option key was the best trigger for my new navigation layout.

Option with IK for Up and Down arrows and JL for Left and Right

It was such a natural setup I became hooked instantly. Eyes on the cursor I would press the Option key with my left thumb and my right hand would move up, down, left, and right with smooth and seamless transition from typing to navigating. It felt like I thought a cursor to move and it magically did.

Next came selection. Left pinky on the Shift key, done. But something was missing. For a coder, moving one letter position or line at a time is like death by strangulation. Text editors have a way of moving by the word or at least to the very end or beginning of the current line. Again, I sat there and observed my natural inclination to move the cursor left or right by the word. And it was very easy to just expand the reach of my right hand fingers a bit more left and right.

Moving by Word and by Line

So H would move the cursor left by the word, and ; would move the cursor right by the word. Taking that further, G would move the cursor to the beginning of the line, and “ would move it to the end of the line.

Paging Up and Down

The final touch was to handle paging up and down. I tried using 8 and , but for some reason it just didn’t feel right. I felt my right hand was traveling too much distance. I tried U and M for Page Up and Page Down respectively and that was a winner.

The final layout with Shift key for selection

So there you have it. I’ve been enjoying this setup for a very long time and I hope it helps you too. To get this setup working I’ve gone through a few products and tricks. I’ve relied upon a combo hack of custom keyboard layout and DefaultKeyBinding, then Keyboard Maestro for a few years, then Karabiner until Sierra finally broke it. Now I’m happy to say that I found SKHD to be the most elegant and effective solution.

Install Homebrew if you haven’t already, and then install SKHD.

brew install koekeishiya/formulae/skhd

Here is my SKHD Dvorak config file. It enables the setup I describe here. Simply put one of those files in your home directory as .skhdrc and start/restart SKHD.

brew services start skhd

Update:

If SKHD is slow for you, it’s probably because your default shell is feature-rich (slow?). An easy fix is to set the default shell to something light like /bin/sh

Here’s how to do it. Edit the service file to set the SHELL environment variable.

brew edit skhd

This will open the service file for you to edit. Find the EnvironmentVariables dict and add a SHELL key and string value:

<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>#{HOMEBREW_PREFIX}/bin:/usr/bin</string>
<key>SHELL</key>
<string>/bin/sh</string>

</dict>

Older KHD info, kept here for reference

brew install koekeishiya/formulae/khd

Here is my KHD Dvorak config file as well as a Qwerty version that enables the setup I describe here. Simply put one of those files in your home directory as .khdrc and start/restart KHD.

brew services start khd

It works with almost all Mac applications I’ve used, some terminal apps being rare exceptions.

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMI family. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

--

--