Frequently Asked Questions
Category
Ways to remap layer switching key and tap/hold keys in VIA.
2023-07-28
There are several common layer-switching keys:
- Mo(n): This function momentarily activates a layer. When you release the key, the layer is deactivated. This function is commonly assigned to the Fn key on our keyboards.
- TG(n): This function toggles the nth layer on and off. It activates the layer if it’s inactive and deactivates it if it’s active. You can think of it as similar to the num lock function. On our keyboards, this function is also used to implement Fn+W.
- DF(n): This function switches the default layer. The default layer is the base layer that is always active, and other layers stack on top of it. It can be used to switch from one layout (e.g., QWERTY) to another. It’s important to note that this is a temporary switch that only persists until the keyboard loses power. Modifying the default layer in a persistent way requires deeper customization.
- LT(n, kc): We will talk about this way later in this article.
To configure tap/hold keys in VIA, you have a few options:
- In VIA, you can find some pre-defined tap/hold keys such as ESC`, LS(, RS), LC(, RC), LA(, RA), and SftEnt. Simply hover your cursor over the key to see the code and its meaning.
- You can use the “ANY” key to program any QMK code. To do this, refer to this link: [LINK].
For example, you can use the code “LT(layer, kc)” to “Turn on a layer when held, and activate the key code ‘kc’ when tapped.” For instance, “LT(2, KC_SPC)” will activate layer 2 when held, and input a spacebar when tapped.
Another code option is “MT(mod, kc)”, which means activating a modifier key (Shift, Ctrl, Alt, Gui) when held and the key code ‘kc’ when tapped.”MT(MOD_LALT, KC_PSCR)” will act as LALT when held, and act as Printscreen when tapped.
You can find more code examples for tap/hold keys in the provided link.