Switching and Toggling Layers: Efficient Keyboard Customization
On a keyboard, each layer can be assigned its own set of keycodes. Each layer represents a group of keycodes, and by switching between different layers, the same key can perform different functions. To switch between different layers, the Keychron Launcher web app allows you to set up a dedicated toggle key. Below are some commonly used layer-switching configurations. This guide will explain these key functions and how to use them to optimize your keyboard experience.
1. Open the Launcher web app
1.1 First, switch your keyboard to wired mode. Connect your keyboard with our cable and click here to open the Launcher. * Please use the latest version of Chrome / Opera / Edge browser to open the Launcher.
1.2 Please click the "connect +" to authorize your keyboard. Click the 'Connect' button and select the keyboard of the corresponding model.
1.3 Connect your keyboard to the Launcher web app.
Note: If you have problems connecting to Launcher, please click here to find a solution.
Learn about Your Layers
Keyboard layer is an important concept in keyboard design, which can distinguish different key functions and layouts.
The Keychron Launcher web app allows you to assign specific functions to different keyboard layers. For example, Layer 0 is typically set as the default keyboard layout, while Layer 2 or other layers can be configured for special needs.
In this example, we will set Layer 0 as the default macOS layout and Layer 2 as the Windows layout. The following introductions are based on this layer configuration.
Six functions to Quickly Switch on Launcher
On Keychron Launcher web app, we have the following functions to set for quickly switching. They are MO(n), TG(n), TT(n), OSL(n), TO(n), DF(n).
Connect your keyboard to the Launcher web app. Click 'Keymap' on the left, and under the 'Layer' column you can find the six function we will introduce.
Note: If you have problems connecting to Launcher, please click here to find a solution.
1. MO(n): Momentarily turn on layer when pressed
What it does: The MO(n) function temporarily activates a specific layer as long as the key assigned to this function is held down. Once you release the key, the layer is immediately deactivated, and the keyboard returns to its previous state.
This function is useful for creating key combinations to act as function keys (like media controls or custom macros).
Example for MO(n):
Assign MO(1) to a specific key (such as the Fn key). When you hold down the Fn key, Layer 1 becomes active.
In layer 1, configure the "D" key to increase the volume.
When you press and hold the Fn key and the D key at the same time, you can increase the volume.
2. TG(n): Toggle layer on or off
What it does: The TG(n) is a function to toogle layer n on or off. Change the state of layer n: if it is inactive, activate it; if it is active, deactivate it. Assign TG(n) to a key to switch between your main layer and layer n (e.g., for the default Mac layer and Windows layer). Press the key once to activate the layer, and press it again to turn it off.
Unlike the momentary activation in MO(layer), the TG(layer) function keeps the layer active until you toggle it off.
Example for TG(n):
Suppose you want to switch between two keyboard layers:
Layer 0 is your default Mac layer.
Layer 2 is your Windows layer.
By assigning TG(2) to a key, such as the Fn key, pressing Fn once will activate Layer 2 (Windows layer). To switch back to your default Layer 0 (Mac layer), simply press Fn again. This TG(n) function allows you to quickly switch between two layers without needing to hold down any keys, making it convenient for users who frequently alternate between operating systems.
3. TT(n): Layer Tap-Toggle
What it does: When holding down this key, the layer will be activated, and then is de-activated when you let go (similar to MO). If you repeatedly tap it, the layer will be toggled on or off (similar to TG). By default, this requires 5 taps. but you can change this by defining TAPPING_TOGGLE -- for example, #define TAPPING_TOGGLE 2 to toggle on just two taps.
Example for TT(n):
Suppose you want to switch between two keyboard layers:
Layer 0 is your default Mac layer.
Layer 2 is your Windows layer.
By assigning TT(2) to a specific key (such as the Fn key), holding down Fn will temporarily activate Layer 2 for Windows, and it will revert back to Layer 0 once you release the key. Additionally, if you tap Fn five times (or the number of taps you've configured), it will toggle Layer 2 permanently, and another five taps will switch it back to Layer 0. This is especially useful when you need quick access to a different layer without holding down a key continuously.
4. OSL(n): Momentarily activates layer until a key is pressed
What it does: The OSL(layer) function momentarily activates a specified layer until the next key is pressed. OSL(n) is a "one-shot" layer activation, meaning the layer stays active only for a single keypress or action. After you press any key while the layer is active, the keyboard returns to its previous state.
Example for OSL(n):
Suppose you frequently use certain function key combinations on your keyboard, but there are too many to handle. In this case, you can use OSL(n) to simplify your operations.
In Layer 2, "Q" is set to "Copy" (Ctrl+C). OSL(2) is assigned to the Fn key. When the Fn key is pressed, Layer 2 is activated, so pressing "Q" will execute the "Copy" function.
Once you press any other key (such as "Q"), the keyboard will immediately return to Layer 0.
5. TO(n): Turns on layer and turns off all other layers, except the default layer
What it does: Activate layer n and deactivate all other layers (except the default layer). This function is unique, because instead of just adding/removing one layer to your active layer stack, it will completely replace your current active layers, uniquely allowing you to replace higher layers with a lower one. It activates when the key is pressed (as soon as the key is held down).
Example for TO(n):
Suppose you want to switch between two keyboard layers:
Layer 0 is your default Mac layer.
Layer 2 is your Windows layer.
Assign TO(2) to a specific key (e.g., the Fn key), pressing and holding Fn will activate Layer 2, switching to the Windows layer. As soon as you release the key, the keyboard will revert to Layer 0, the default layer.
6. DF(n): Set the base (default) layer
What it does: DF(n) is a function used to temporarily switch the default layer to layer n. The default layer is the always-active foundational layer that other layers stack on top of. Note that this is a temporary switch and will be invalid after the keyboard is powered off.
Example for DF(n):
Suppose you want to switch between two keyboard layers:
Layer 0 is your default Mac layer.
Layer 2 is set up for Windows layer.
Assign DF(2) to a specific key (e.g., the Fn key), pressing the Fn key will temporarily set Layer 2 as the default layer, meaning all keys will follow the Windows layout. Once the keyboard is powered off or reset, this setting will be canceled, and the default layer will revert to Layer 0.
4. How to set up more layers on a single system keyboard
The above explanation of Layer switching and its usage are applicable to keyboards that have dual-system layers for Mac and Windows. For some keyboards that only support Windows systems by default, if you want to set up a keyboard that is exclusive to your Mac system, please refer to the following tutorial.
Using the Lemokey P1 Pro keyboard as an example. The default layer of the P1 Pro is Windows, with Layer 0 and Layer 1 corresponding to the Windows key layers, while Layer 2 and Layer 3 are blank. If you need to set up a Mac system, you can customize it on Layer 2 or Layer 3.
Follow the steps below:
4.1 Click 'Keymap' on the left, and click on the key that you want to program, and the key will be marked with a red box. Click on a key you want to remap in the Basic/ Media/ Macro/Special/ Lighting/ Custom/ Layer section. And it's done. Here is a video example.
4.2 Due to the Lemokey P1 Pro being configured by default for the Windows system, you may not find all the necessary Mac system keys in the existing key library of the Launcher. In this case, you can click the "Any" key under the "Custom" section and manually input the required keys’ hexadecimal keycodes for customization.
You can find all supported customization keys here.
Then find the corresponding keycode defines here.
Note: You can only find the corresponding hexadecimal key code under the Keycode defines column.
For example, 0x0004 is the hexadecimal keycode for KC-A. Enter 0x0004 in the "Any key" option to set the key as the A key. Here is a video example.
4.3 After setting up the Mac key layer, the method of switching layers is the same as described above. You can refer to the previous tutorial to set the layer switching key.