My Keyboard Setup

I use my keyboard to control my computer as much as possible. By using a keyboard to navigate, launch, and manage your applications and data, you can be faster and more accurate than with just a mouse because you can put combinations and chords into your muscle memory.

Here's more information than you ever wanted to know.

Controlling your keyboard

I used to remap tons of things on my keyboards, but I've worked it down to two main ones: I need my keyboard to have a CTRL key where Caps Lock normally is (inspired by "Modern Space Cadet" by Steve Losh) and I need an F19 key to fire off a second layer of "Hyper" key chords.

That special Hyper Key goes to some program that can change it into the mega-chord of CMD+SHIFT+OPT+CTRL... which is not used anywhere else in the OS. That way I can be sure when I define a shortcut I'm not overriding anything else!

I use karabiner elements to remap my built in laptop keyboard. I use QMK to rewrite the firmware for all my mechanical keyboards, so they "natively" have an F19. Both configurations put the F19 as the bottom left key on the keyboard, where FN usually goes.

older image of my planck layout
A mostly up to date representation of my 4x12 ortho layout. There are at least two other layers not represented.

Hyper

My hyper key does a few things: launches/focuses different common apps, moves and aligns windows, and fires some small scripts that I've written.

I mostly used it to switch between my terminal and my browser in my work as a front-end developer. Using iTerm's non-native full screen, it meant I could have a focused full screen environment without the .25s animation that goes with OSX's built in full screen. Once you try it, you can't go back to CMD+TAB.

I have gone through several different versions of the "Hyper" setup. Originally, I followed the original blog post to the letter, using Keyboard Maestro. Later I rebuilt it using Alfred workflows... mostly to try and cut down on the amount of applications I was using. Both of these were a little slow.

Since discovering hammerspoon, I've been using that as an abstraction layer to fire and control my mac from my keyboard. It's been way faster for app switching than Keyboard Maestro or Alfred, and because it's code I can check it into git and sync it between my work and home computer.

Hyper Hammerspoon

My full hammerspoon config is here. A quick walkthrough:

My main configuration file is init.lua. It contains a list of applications. I can set what monitor I prefer them to be on for my window manager, I can set a hotkey for launching/focus, and I can also set a list of hotkeys I want to make available for use inside that application, all under my Hyper layer.

There is a plethora of keyboard shortcuts on OSX, and using the Hyper key layer means that I can have universal shortcuts that work regardless of what application I have focused without worrying about accidentally doing something in my current application.

When an F19 key is pressed, hyper.lua is listening and invokes a layer that fires actions based on the list in init.lua. If the application for which the shortcut key is pressed isn't open, it opens it and then presses the key again. This lets me have a button that always opens a new Drafts.app draft or a new Tweetbot tweet... even if the application isn't open yet.

Here, I demonstrate how quickly I can switch between my terminal and browser, without app switcher, just from my keyboard.

I'm using Keycastr so you can see what I'm typing... when Hammerspoon handles the F19 and doesn't send the hyperchord, you'll see a weird question mark.

I also make the hyper layer available to my scripts for moving windows and starting timers, so that they are always one key away, no matter what application I'm in. I've detailed the pomodoro timer elsewhere, but the move windows script is partially written by Tom Miller with some modifications by me.

Picture of a workstation
Full description of the setup here.

Thanks to some help from @megalithic and nice people using hammerspoon I also have hammerspoon automatically throwing applications to the windows I prefer them to live as soon as I add or remove a monitor. This is very handy for when I come back to my workstation after being in a meeting.

The latest addition is a simple script that connects/disconnects my Airpods with a single button.

Keyboard Interfaces to other Applications

Besides using vim and memorizing as many shortcuts as possible, I use a couple of other tools to keep my hands on home row.

Alfred

alfred

I've been using an app launcher for a long time. I think I heard Merlin Mann talk about the quicksilver talk at google on an old Macbreak Weekly. I believe the dev was subsequently hired by google, but that video alone made me buy a Mac as my next computer.

Since then I've used Quicksilver, Launchbar, and now Alfred. For more information about why Alfred and an overview of the general usefulness of Alfred, check out the excellent review over at the sweetsetup, but here are a few of the more esoteric things I use it for:

Vimium

I really like Vim's modal interface. I've found that Vim's shortcuts are in my fingers and therefore I tend to use it everywhere that I can.

Here I'll use some basic vimium features to scroll, open some tabs, and open tabs in background. It has more power, but that's what we are mostly doing on the intertubes, right?

There's an awesome family of plugins for web browsers that bring some of those shortcuts to vim, both in terms of search and scrolling, but also interacting with links. I mostly use it to navigate, using the f operator to open links that are interesting to me.

OSX Readline

OSX has a rather robust version of readline shortcuts available everywhere there's a cursor. I use <C-a> and <C-e> constantly... you can find a full list here.

I'm constantly surprised that it has an actual killring register separate from the built in clipboard. It's occasionally very handy.

OSX Keyboard Pref Pane

OSX Pref Pane -> Keyboard -> Shortcuts -> App Shortcuts

I do have one more configuration trick: I use the built-in keyboard shortcuts pane to rebind keys. There's a bit of a trick to it, you have to put in the precise name of the Menu item and a keyboard shortcut... even counts ellipsis or specific possessive apostrophes. I'll rebind some keys to more familiar positions, or more often unbind shortcuts that interfere with OSX's built in readline shortcuts. (Looking at you, Sketch.app!)

OSX Help Menu

I've known this one for a long time, but a lot of people haven't realized: if you hit CMD+SHIFT+/ (basically CMD+?) in most OSX apps it'll focus the search box in the Help menu. It searches every menubar in the application. I originally used it to find things in Photoshop that I had forgotten where they were... but now I just use it to quickly access the menubar.

Apparently there's a way to do this even faster/better using BetterTouchTool or Hammerspoon, I may look into that. I'll use SketchRunner for this in Sketch.app.

QMK Layers

more shortcut layers

I have adopted the ortholinear keyboard full time... and it's led to a couple interesting changes.

I have a key on the right side of the keyboard that converts a portion of the right side to a tenkey, making entering numbers a little faster with one hand. I also have another layer for when I hold the tab key... it makes the top row (QWERT) send CMD+1-4, a common OSX shortcut for switching tabs, focusing certain views... I've also bound a couple other convenience functions so that my left hand can reach all the things that I need for designing while my right hand is on my mouse.

There is a layer for gaming too if I'm using a 4x12 board, but that's another blog post.

Conclusion

After typing portions of this into slack a few times, I finally decided to put it all in one article... at least for now. It'll change in another year I'm sure. Regardless of what parts you decide to implement and how, I think that being efficient with tasks through automation or scripting can make you a more effective information worker. The parts that I can't do without anymore:

  • jumping to apps
  • searching for/inside files quickly and acting on them

I think that a decade of tweaking how I move between programs on my computer has landed me in a good place, I'm now more interested in doing more automation for repetitive or predictable tasks. Stay tuned!

References:

Inspiration

Tools Used


Changelog
  • 2024-02-20 09:38:14 -0600
    Convert to permalinks

  • 2022-06-08 11:31:29 -0500
    Rename articles

  • 2020-09-28 09:20:43 -0500
    Change repo name

    I decided to change the name of my hammerspoon configuration repo to
    `hammerspoon-config` to avoid confusion... it's not the actual
    hammerspoon executable, it's a configuration for that executable.

  • 2020-06-18 14:26:02 -0500
    Move everything to CST

    Don't know why I didn't do that before. It caused _no_ end of
    problems.

  • 2019-11-14 19:33:21 -0600
    Auditing the tags in the site...

    Many removed, cleaned up, or renamed.

    Tags with only one child got yanked.

  • 2019-04-04 12:36:32 -0500
    Mention my other weird QMK layers

  • 2019-04-03 22:41:34 -0500
    Remove broken image

  • 2019-04-03 21:25:21 -0500
    Write Keyboard blogpost