Keyboard Builders' Digest / Tips & Tricks
The SpaceFN concept
The SpaceFN concept - setting up your space key as a layer switch when held - is probably one of the most useful tweaks in the keyboard hobby. Let me explain it.
Published March 14, 2024
On my imaginary top list of the best and most useful keyboard features, tweaks and hacks, SpaceFN would deserve a podium finish for sure (probably preceded only by a proper split thumb cluster). But what makes it so special?
In short: SpaceFN is easy to implement, easy to learn, costs nothing, can be used with any keyboard, and can improve your productivity instantly.
I could (and will) go on and on about its benefits, but can state right at this point already that the SpaceFN concept is clearly one of the most useful tweaks in the keyboard hobby. On a basic level it means setting up your space key as a layer switch when held. Why? How? Let me explain it so you can start boosting your productivity right away.
Embrace the undisputed greatness of Space FN
The mechanical keyboard hobby is full of personal preferences and subjective opinions, but if there are any absolute, universal truths, one of those is the undisputed greatness of SpaceFN. If you already use it, you may read this article as a self-justification. If you heard about SpaceFN but haven't tried it yet, let me convince you and show you some implementations. And if you're not sure about what SpaceFN is, read this write-up because it may change your life – well, at least that part you spend in front of monitors.
Setting up Space FN is the very first thing I do when I get a new keyboard…
…and believe me, running a blog called kbd.news makes it pretty much unavoidable to get and test new keyboards every week. Loosely recreating my custom keymap and being able to use an additional SpaceFN layer is crucial, especially when I have to revert to the standard layout and horizontal staggering after using split keyboards.
Well, as a matter of fact, I don't even have to set up SpaceFN in this case. Because I find it so essential that a handy tool is running on my PC taking care of this for me, automatically. I do think it would be a real blunder if you missed this incredible feature, so do yourself a favor and read on.
Est. 2013 (or 1989?)
Throughout my years in the keyboard hobby I've been mentioning the SpaceFN concept all the time, and even used it in one form or other, way before I learned about programmable mechanical keyboards. (Yep, this means you can use the concept on any keyboard, cheap and dumb rubberdomes included.) I realize that referencing the method without offering a comprehensive tutorial is not the most useful thing – so here it is finally, a dedicated article about the Space FN concept.
I'm not the one who came up with this concept of course, and while referencing notable contributors back to the '90s, I'm pretty sure the roots of this method date back to the early days of computing.
But what exactly is SpaceFN? How to set it up e.g. with VIA or Vial? How to achieve the same behavior with third-party tools if your keyboard is not QMK-compatible and thus cannot be programmed? How to replicate Space FN on rubberdome keyboards for that matter?
Let me explain it with some examples! Click here if you don't care about the background and benefits, but are only interested in the setup instructions so you can start using it right away. Even more specific links: SpaceFN in VIA, SpaceFN in Vial, SpaceFN in QMK, SpaceFN for non-programmable keyboards.
What is SpaceFN?
In short: The SpaceFN concept means you use your spacebar as a layer switch when held. If you are familiar with QMK terminology, this is a simple layer-tap double-function.
Confused already? Here's the gist:
You turn the spacebar into a double-function key, making it behave differently when pressed shortly compared to when held down. One key, two functions.
If you hit your spacebar shortly, it produces a space character as usual and expected. If you hold it down, you activate a new layer. All the other keys may have a new function this way, pretty much anything you'd like: arrows, navigation, numbers, you name it.
Brilliant, isn't it?
Why is Space FN so useful?
When it comes to the SpaceFN concept, even seasoned keyboard smashers can be confused. That's why it's important to understand its behavior, all the benefits – and a few cons too to be honest. If you can't think of why this is a game-changer, let me help you out with a few ideas. Here come the pros:
The most important factor in my opinion is that by turning your spacebar into a double-function key, you can access a new layer and new functions without moving your hands. I'm talking about a whole new logical layer in the keymap. (No panic if this doesn't make much sense to you right now, we will get to it.)
You get a bunch of new functionality while staying on the home row. Your thumbs are already resting on the spacebar anyway, so you don't have to navigate away when reaching over to a dedicated FN-key, e.g. in the bottom row or even worse position, like with the default Whitefox layout.
You can activate your FN layer with either thumbs! Allowing you to use modifiers with any key combination.
Often, the built-in FN layer a new keyboard may be shipped with conceals pretty useless or rarely needed functions like RGB animation, color and brightness, Bluetooth functions, mouse keys, etc. You may or may not use these at all, but this is definitely not what you want to access via holding the spacebar. You want really useful, frequently used stuff under your fingertips.
What exactly is useful depends on your workflow and use case of course, but I personally would put my first and most important layer there: arrows and navigation, numbers, some frequently used symbols, maybe F-keys if there's enough room.
Imagine that you don't have to reach over to the arrow cluster, because it's already under your right hand fingers when the spacebar is held.
Imagine that you don't have to move up to the number row either (covered later), accidentally getting lost not being able to find your way back to the homing keys, resulting in an endless cycle of typos and attempted corrections. This is not a problem at all if all the numbers are beneath your left hand fingers. (Slightly jumbling your numbers like I did in some of the examples is optional. ;))
F-keys? You can put them to the number row if you'd like, bringing them a bit closer.
What I personally love about SpaceFN is that it can simulate a split thumb cluster behavior, making life much easier when having to deal with standard layouts and horizontal stagger after using ergo boards. From a different point of view, you can simulate some ergo split behavior with a standard keyboard, preparing your next jump into the split rabbit hole. ;)
All in all, doesn't this sound awesome?
What are the cons of SpaceFN?
Before we delve into how to set up Space FN, let's talk about the few disadvantages this setup has, for the sake of completeness.
These cons I'll mention below may or may not affect you, but let's see it for yourself:
- You cannot hold your spacebar to churn out multiple spaces, so no auto-repeat (gaming?).
- Space characters are registered when releasing the key (keyup event) rather than when pressing it (keydown).
- Holding spacebar for a prolonged time may cause fatigue, strain, etc. in your thumbs
Let's investigate the first no-autorepeat "issue", but let me be right clear: it makes absolutely no sense to use your spacebar for e.g. aligning text with spaces. If you're that nasty person, you won't be able to do this after setting up SpaceFN simply because you turned the hold function into a momentary layer switch key in QMK terms. It will produce only one space when pressed (actually released as we will soon see), and exactly zero spaces if you hold it.
One easy fix for this is to put a space on the SpaceFN layer, like spiceBard did it in the original proposal – or even better you could forget about this questionable behavior for good.
Even with this quick fix, this may cause problems for gamers if you can't remap the default task associated with the space key, but I'm not sure to be honest. Haven't played any game for ages which required holding the spacebar. Probably depends on the particular game or genre.
The other disadvantage will affect even fewer people, and because they are most likely hardcore keymap wizards, they will know how to cope with this. So spaces are registered on release. Why? Because double-function keys have to be handled differently by e.g. QMK: the firmware has to wait a bit to decide if you hold it or simply pressed it. And this takes time. Usually longer than a normal tap, so you end up with space registering on release.
"Normal" keys, without a hold function, don't have this problem. Pressing an A (without home row mods set up) can be registered right on the press event.
So why is this an issue? Is it a problem at all? For most of you: Not really. The only real problem is if you are experimenting with keymap performance and measure or log keypress times. In this case you'll have to revert back to single-function keys, otherwise your results will be flawed.
How to set up SpaceFN?
SpaceFN can be easily set up using popular tools like VIA, Vial or QMK, but there are many third-party apps too for the case your keyboard in not programmable. That's what I used for my cheap rubberdome keyboard many years ago, when I haven't even heard of mechanical keyboards yet. But let's cover programmable mechanical keyboards first:
How to set up SpaceFN in VIA?
For this example I plugged in my VIA compatible Whitefox Eclipse:
- Navigate to usevia.app and pair and connect your device
- Set up layer tap on your spacebar on the base layer
- Set up the layer and functions you'd like to access while holding the spacebar
As a first step, we are going to turn our spacebar into a double-function key. Actually, there's a Space Fn function in VIA, which we can use as a shortcut to assign LT 1 (or 2, 3) to space on the base layer. In fact, something like LT(1, KC_SPC) would be the general layer tap function in QMK, meaning you get your layer of choice when the spacebar is held, and the chosen character when pressed – i.e. space in this case.
So click Space on the default Layer 0 to make it active:
Select the LAYERS tab (bottom left corner), and click one of the Space Fn1 (or 2, 3) buttons:
I clicked Space FN2. This will assign the layer tap function to your Space, activating Layer 2 when held:
Congratulations! You've just set up your spacebar in VIA!
All you have to do is now to create Layer 2 if you haven't done so yet. E.g. here is an example layout very similar to the original SpaceFN keymap published by spiceBar back in 2013.
(Keep in mind that for all the unused keys, setting them transparent would make more sense. I only set them to KC_NO for better visibility of the SpaceFN functions.)
But I like to add more functionality so I don't have to leave the main typing area for arrows (navigation and editing) and numbers either:
Or even some parentheses for coding:
That's it! Well done. This is still just a starting point. You don't have to stick to these examples, let's go ahead and adapt the concept to your workflow.
How to set up SpaceFN in Vial?
For this example I plugged in my Vial compatible KBDcraft Adam:
- Navigate to vial.rocks and pair and connect your device
- Set up layer tap on your spacebar on the base layer
- Set up the layer and functions you'd like to access while holding the spacebar
As a first step, we are going to assign LT 1 (or 2, 3) to space on the base layer. This general layer tap function turns your spacebar into a double-function key, meaning that you get your layer of choice when held, and the chosen character when pressed – i.e. space in this case, but pretty much anything else you'd like.
So click Space on the default Layer 0:
Select the Layers tab, and click LT 1 (or 2, 3):
Click LT 1 (or 2, 3). This will assign the layer tap function to your Space (and the active key in the screenshot is now the next one: RAlt):
Click the tap box of the LT 1 function assigned to your spacebar:
Select Space from the function list (Basic or ISO/JIS tab):
Congratulations! You've just set up your spacebar to produce a space when tapped, and to switch to Layer 1 when held.
All you have to do is now to create Layer 1 if you haven't done so yet. E.g. here is an example layout very similar to the original SpaceFN keymap published by spiceBar back in 2013.
(Quick note: Setting all the unused keys to transparent would make more sense. For this example I set them to KC_NO for better visibility of the SpaceFN functions.)
But I like to add much more functionality so I don't have to leave the main typing area for e.g. arrows (navigation and editing) or numbers either:
That's it! Well done. This is still just a starting point. You don't have to stick to these examples, let's go ahead and explore all the possibilities.
How to set up SpaceFN in QMK?
In basic QMK terms, SpaceFN is simply:
- LT(1, KC_SPC)
On a general level, you can assign this to any key, but if we break it down, this particular example means:
- "LT": layer tap (turning the key into a double-function one, assigning two different function when pressed or held)
- "1": when the key is held, activate Layer 1 (momentarily)
- "KC_SPC": when the key is pressed (shortly), output the KC_SPC (space) keycode
For more details, you may look into the Layers section of the QMK docs:
LT(layer, kc) - momentarily activates layer when held, and sends kc when tapped. Only supports layers 0-15.
How to set up SpaceFN with non-programmable keyboards?
All is not lost if your keyboard is not programmable. There are apps running on your host computer doing pretty much the same thing: listening for your spacebar and remapping keys when it's held.
SpaceFN on Windows
When I came across this concept for the first time, I stumbled upon TouchCursor, a free Windows software. First released in 2006, last updated in 2010, I still have it running on my keyboard testing PC. :D So if I plug in any new keyboard, I already have spacefn and don't have to bother with VIA/Vial, or especially some obscure proprietary software.
While its most important job is to put arrow functions on your home keys, it has a lot of related features.
However, TouchCursor is only one from the many similar apps. It's very handy, but e.g. if you use AutoHotKey for various tasks already, you can set up Space FN in AHK too. Here is an AHK example by lydell.
Another tool I used, basically an AHK extension, was PKL (Portable Keyboard Layout) by Máté Farkas. You don't have to install anything and can take your layout with you.
--
Let me know what tools you use for Mac/Linux so I can add some more options here.
SpaceFN on Linux
Matthias Goffette found KMonad useful for Linux.
I constantly switch between keyboards (work, home, laptop…) and so I use regular non-programmable keyboards most of the time still, with Linux. But I’ve discovered KMonad about a year ago, and it has allowed me to implement a SpaceFN. Essentially, it allows me to use any keyboard as a 60%, which matches my Lily58 relatively well. I use terminals a lot and a tiling managers, so I do a lot of operations with my keyboard and not my mouse (moving between windows for instance), so being able to have easily accessible arrow keys is a must – Matthias.
Example layout
The original idea back in 2013 materialized as a semi-standardized SpaceFN layer. Still, I like to call it a concept, because as already told, you can and should put whatever you want on your SpaceFN layer. Anyway, here is the original layer by spiceBar for history's sake:
Here is something I like to use as a start when setting up a new keyboard:
As you can see, now I don't need a dedicated arrow and navigation cluster, nor the number row to type numbers.
At this point I only wish split spacebars would be mandatory on every keyboard. It would double (actually triple) the number of your easily accessible layers.
Conclusion
By assigning a second (hold) function to your spacebar, you can access a whole new logical layer stuffed with dozens of useful functions without even moving your hands. Staying on the home row results in less overall movement, but it also prevents a lot of typing errors. Both of your thumbs are already resting on the spacebar, so it should be dead easy to adapt to this new setup.
I've been using Space FN ever since 2018, and I can only recommend you to give it a try if you haven't done so yet.
Resources & History
The first useful post on the subject I came across was probably this geekhack thread by spiceBar, from 2013.
The author credits a handful of people, e.g. Matias.ca's Edgar Matias "for his work on the dual use of standard keys as modifiers, 20 years ago". That means in the early '90s. A reference of this dual use in general can be found in this article.
"I was sitting in English class . . . and basically staring off into the distance . . . and I thought of . . . assign two letters to a key."
Simon Lydell deserves credit too, for implementing the layout for Windows as an AHK script (github) – in 2013 as well.
And of course we have to mention the authors of TouchCursor and PKL, Martin Stone and Máté Farkas, respectively.
Plus the authors/users of Vi/Vim for championing the idea of having arrows in the home row.
Published on Thu 14th Mar 2024. Featured in KBD #158.