Keyboard layers on a Mac: put your own actions on a held key
A keyboard layer is a second set of jobs for your keys that is active only while you hold one key down. Hold the layer key and the letters open apps, type text or send shortcuts; let go and they type letters again. macOS has a couple of built-in layers, but no way to make your own. For that you need a remapping tool, a programmable keyboard, or an app such as Typebar, whose layers also show on an on-screen keyboard while you hold the key, so you can see what each key does.
Layers you already use
You hold keys to change what other keys do all day. Shift is the oldest layer there is: hold it and every letter becomes a capital. A Mac has two more worth noticing.
fn on a MacBook. A MacBook keyboard has no Home, End, Page Up or Page Down keys. They are on a layer: hold fn and the arrow keys change.
| Shortcut | Does |
|---|---|
| fn-↑ | Page Up |
| fn-↓ | Page Down |
| fn-← | Home |
| fn-→ | End |
| fn-Delete | Forward Delete |
They do what the dedicated keys do on a full-size keyboard.
Option. Hold Option and the keys type characters instead of letters. On a US layout, Option-G types ©, Option-2 types ™ and Option-8 types •. The characters depend on your input source, which is why the Keyboard Viewer, or holding Option with an overlay showing, is the easiest way to see them.
So the motion of a layer (hold, press, release) is already in your fingers. What macOS does not offer is a layer you fill yourself.
What a layer of your own is good for
A layer earns its place with jobs you do many times a day, from any app, that have no good shortcut of their own:
- Open apps. Hold the layer key, press M, and Mail comes forward. One key per app you live in.
- Type text you repeat. An email address, a postal address, a sign-off, a code snippet. Type your email, address or code snippet with one key press covers this one.
- Send a shortcut you find awkward. Command-Shift-5 (⇧⌘5) opens the Screenshot toolbar; Control-Command-Q (⌃⌘Q) locks the screen; Option-Command-Esc (⌥⌘⎋) opens Force Quit. On a layer, each becomes one key.
- Show something without doing anything. For a tutorial, a key can carry a symbol and a caption, so viewers see which keys a game or an app uses.
The common thread: a layer gives you a whole keyboard of single-key actions on one key you would not otherwise hold, available from any app.
Ways to build one on a Mac
macOS on its own has pieces, not layers. The Shortcuts app can run an Open App action from a keyboard shortcut (in a shortcut’s details, choose Add Keyboard Shortcut). App Shortcuts, in System Settings > Keyboard > Keyboard Shortcuts, gives any menu command a shortcut. Text Replacements (a button in System Settings > Keyboard) expands an abbreviation as you type. Each is a separate shortcut you have to remember, and nothing gathers them into one map you can see while you work.
Karabiner-Elements is free and open source, and its rules can turn a held key into a layer. It is flexible, and you set it up with rules written in JSON or imported from its online library, rather than by filling in a picture of a keyboard.
A programmable keyboard keeps layers in its firmware. QMK, for example, has momentary layer keys that switch layers while held. The layers go with the keyboard to any computer, but they are tied to that keyboard.
Typebar builds layers in its settings and draws them on its on-screen keyboard. That last part is what makes a layer stick: you do not have to remember the map, because it appears while you hold the key.
Building a layer in Typebar
Layers live in Settings > Layers. A layer is a key you hold plus the keys it fills, and each key on a layer can do one of four things: open an app, type a snippet, send a shortcut, or show a symbol with a caption.
The choices that shape a layer:
- The key you hold. Pick one that does nothing useful when held on its own. Right Command is a good fit, since few people press it for anything, and so is a Hyper key if you have one. Hyper key shortcuts covers what else a Hyper key can carry.
- The hold time. Each layer has its own. A short hold suits a layer you use constantly. A longer one suits a key you also press in ordinary shortcuts, so a quick shortcut does not bring the layer up.
- Where it works. A layer can work in every app or in just one. Layers for opening apps and typing snippets belong in every app; a layer of shortcuts for the editing app you teach can work in that app alone.
- What goes on each key. Start with five or six keys, on letters you could guess. Fill more when you notice yourself doing the same thing by hand again.
Typebar also has a ready-made Apps layer, added in one click, that puts your running and Dock apps on their first letters. Switch to any app with one held key and a letter explains how it works.
Each layer is saved to a file you can share. Send one to a teammate, or set up the same layer on another Mac without rebuilding it.
Layers for recording and teaching
The symbol-and-caption keys are made for tutorials. Showing which keys a game uses, or the four keys Vim moves with, is clearer on the board than in a sentence.
A layer can also be put on the keys from a script or another app, without anyone holding a key. This command, run in Terminal or from a script, puts arrows on H, J, K and L, and the typebar:// link inside it works from Raycast or Alfred too:
open -g "typebar://layer/show?h=s:arrow.left&j=s:arrow.down&k=s:arrow.up&l=s:arrow.right&fill=blank"
The typebar command-line tool, installed from Settings > Automation, lists your layers with typebar layers list, and the Shortcuts app has a Show Layer action. Automation changes what the board shows. It never types or presses keys for you. Show arrows or symbols on the keys for a game or app tutorial has more examples.
Keep a layer usable
Layers fail the same way any shortcut system does: too much, too soon, on letters nobody could guess. A few habits help:
- First letters for apps, arrows for anything with a direction, and the same letter for the same idea across layers.
- One job per layer. An apps layer, a snippets layer, a layer for the app you edit in. Mixing them makes every key harder to find.
- Leave gaps. Empty keys cost nothing and leave room for the next good idea.
- Hold and look. While you are learning a layer, hold the key a beat longer and read the board before you press. Before long you will stop looking.
Typebar is $9 once for up to 5 Macs, with a free 24-hour trial and no card.
Questions
Does a layer change what my keys do normally?
A layer belongs to a key you hold, so it comes up only when you hold that key for the layer’s hold time. Each layer works in every app or just the one you choose.
Can I hold Caps Lock for a layer?
If you have turned Caps Lock into a Hyper key with another tool, you can hold the Hyper key. Otherwise pick a key you rarely hold, such as right Command.
Can I move my layers to another Mac?
Yes. Each layer is saved to a file, so you can copy it to another Mac or share it with someone else.