Layout Definition

The keyboard layout is defined in layout.js. If you wonder why these and other files have the extension .js: They can be loaded as Javascript into a locally opened HTML page. For example: PinMapper.html uses this mechanism to read the key positions from keypositions.js. There is actually no HTML based tool for managing layout.js.

Sections

layout.js consists of sections. Each section begins with a section keyword in one line and ends with the next empty line. These are the three available section types:

  • keyboard
  • layout
  • layer

The order and count is important. It starts with the keyboard section, followed by a layout section and finally one or more layer sections.

Keyboard section

The keyboard section defines some timeouts which apply to all keys.

To describe these values, I have to talk about the various action triggers first. The PicoSplit firmware supports three triggers for each key:

  • tap
  • long_tap
  • hold

A tap action is triggered when you press and release a key before tap_timeout (in seconds).

A long tap action is triggered when you press a key longer than tap_timeout but release it before long_tap_timeout (in seconds). In combination with the Shift action, which will be described later, you can type a capital letter, just by holding the key down a little longer.

A hold action is immediately triggered when you press a key. If you release the key before long_tap_timeout the hold action is released before a tap or long tap is triggered. If you press the key longer than long_tap_timeout, the hold action is released when you release the key. Its action does not affect a tap or long tap if it emits modifier keys or switches to another layer.

You are probably wondering what this is good for? With the hold action you can assign modifiers to keys which are normally used to type characters. The PicoSplit keyboard uses hold actions to put all modifiers on the home position keys. Hold actions are also used to activate some layers.

Layout section

The layout section has just one property, the name of the layout. Currently layout.js can have only one layout section.

Layer section

A layer has a name. It contains rules for action triggers (tap, long_tap or hold). There must be at least one layer - the base layer - and you can define multiple additional layers. Only one layer can be active at any time. However, rules do not have to be defined for all keys on each layer. For keys without a rule, the rule from the base layer is used.

Here is an example with all three action triggers and all available actions:

A line which defines rules for a key starts with the key number followed by at least one rule. A rule consists of the trigger name (tap, long_tap or hold) followed by the equal sign and the action. Rules are separated by colons.

Actions

Codes[ < Keycode >, < Keycode >, … ] Emits the given key codes at the same time. 

Sequence[ < Action > ; < Action > ] Emits the given actions one after the other. Sequences are currently not nestable and are only tested with Code actions. Note: The separator between actions inside sequences is a semicolon.

Shift Can be triggered by a long_tap and is only usefull if a tap action exists. It triggers the tap action and emits the key code of the shift key at the same time. This is used to emit capitalized letters on a long tap.

ChangeLayer( < layer name > ) Activates the layer with the given name as long as the trigger (tap or hold) is active.

ResetKeyboard Resets the keyboard.

Key codes

This is an overview of all available keycodes you can use inside layout.js

Characters

Code Symbol Symbol with Shift
A a A
B b B
C c C
D d D
E e E
F f F
G g G
H h H
I i I
J j J
K k K
L l L
M m M
N n N
O o O
P p P
Q q Q
R r R
S s S
T t T
U u U
V v V
W w W
X x X
Y y Y
Z z Z

Numbers

Code Symbol Symbol with Shift
ONE 1 !
TWO 2 @
THREE 3 #
FOUR 4 $
FIVE 5 %
SIX 6 ^
SEVEN 7 &
EIGHT 8 *
NINE 9 (
ZERO 0 )

Special Characters

Code Symbol Symbol with Shift
MINUS - _
EQUALS = +
LEFT_BRACKET [ {
RIGHT_BRACKET ] }
BACKSLASH \
POUND # ~ (Non-US keyboard)
SEMICOLON ; :
QUOTE ' "
GRAVE_ACCENT ` ~
COMMA , <
PERIOD . >
FORWARD_SLASH / ?
CAPS_LOCK Caps Lock

Keypad

Code Symbol Symbol with Shift
KEYPAD_NUMLOCK Num Lock (Clear on Mac)
KEYPAD_FORWARD_SLASH Keypad /
KEYPAD_ASTERISK Keypad *
KEYPAD_MINUS Keyapd -
KEYPAD_PLUS Keypad +
KEYPAD_ENTER Keypad Enter
KEYPAD_ONE Keypad 1 End
KEYPAD_TWO Keypad 2 Down Arrow
KEYPAD_THREE Keypad 3 PgDn
KEYPAD_FOUR Keypad 4 Left Arrow
KEYPAD_FIVE Keypad 5
KEYPAD_SIX Keypad 6 Right Arrow
KEYPAD_SEVEN Keypad 7 Home
KEYPAD_EIGHT Keypad 8 Up Arrow
KEYPAD_NINE Keypad 9 PgUp
KEYPAD_ZERO Keypad 0 Ins
KEYPAD_PERIOD Keypad . Del
KEYPAD_BACKSLASH Keypad \ | (Non-US)
KEYPAD_EQUALS Keypad = (macOS)

Whitespaces

Code Symbol
ENTER Enter (Return)
RETURN Alias for ENTER
ESCAPE Escape
TAB Tab and Backtab
SPACEBAR Spacebar
SPACE Alias for SPACEBAR

Insert and Delete

Code Function
INSERT Insert
DELETE Delete forward
BACKSPACE Delete backward (Backspace)

Function

Code Function
F1 Function key F1
F2 Function key F3
F3 Function key F3
F4 Function key F4
F5 Function key F5
F6 Function key F6
F7 Function key F7
F8 Function key F8
F9 Function key F9
F10 Function key F10
F11 Function key F11
F12 Function key F12
F13 Function key F13 (macOS)
F14 Function key F14 (macOS)
F15 Function key F15 (macOS)
F16 Function key F16 (macOS)
F17 Function key F17 (macOS)
F18 Function key F18 (macOS)
F19 Function key F19 (macOS)

Navigation

Code Function
HOME Home (often moves to beginning of line)
PAGE_UP Go back one page
END End (often moves to end of line)
PAGE_DOWN Go forward one page
RIGHT_ARROW Move the cursor right
LEFT_ARROW Move the cursor left
DOWN_ARROW Move the cursor down
UP_ARROW Move the cursor up

Modifiers

Code Function
LEFT_CONTROL Control modifier left of the spacebar
CONTROL Alias for LEFT_CONTROL
LEFT_SHIFT Shift modifier left of the spacebar
SHIFT Alias for LEFT_SHIFT
LEFT_ALT Alt modifier left of the spacebar
ALT Alias for LEFT_ALT; Alt is also known as Option (macOS)
OPTION Labeled as Option on some Mac keyboards
LEFT_GUI GUI modifier left of the spacebar
GUI Alias for LEFT_GUI; GUI is also known as the Windows key, Command (macOS), or Meta
WINDOWS Labeled with a Windows logo on Windows keyboards
COMMAND Labeled as Command on Mac keyboards, with a clover glyph
RIGHT_CONTROL Control modifier right of the spacebar
RIGHT_SHIFT Shift modifier right of the spacebar
RIGHT_ALT Alt modifier right of the spacebar
RIGHT_GUI GUI modifier right of the spacebar

Others

Code Function
PRINT_SCREEN Print Screen (SysRq)
SCROLL_LOCK Scroll Lock
PAUSE Pause (Break)
APPLICATION Application: also known as the Menu key (Windows)
POWER Power (macOS)
Mapping Keys