qmk_firmware/assets/feature_layers.md.8GwBUTZN.js

16 lines
32 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js";
const __pageData = JSON.parse('{"title":"Layers","description":"","frontmatter":{},"headers":[],"relativePath":"feature_layers.md","filePath":"feature_layers.md"}');
const _sfc_main = { name: "feature_layers.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="layers" tabindex="-1">Layers <a class="header-anchor" href="#layers" aria-label="Permalink to &quot;Layers {#layers}&quot;"></a></h1><p>One of the most powerful and well used features of QMK Firmware is the ability to use layers. For most people, this amounts to a function key that allows for different keys, much like what you would see on a laptop or tablet keyboard.</p><p>For a detailed explanation of how the layer stack works, checkout <a href="./keymap#keymap-and-layers">Keymap Overview</a>.</p><h2 id="switching-and-toggling-layers" tabindex="-1">Switching and Toggling Layers <a class="header-anchor" href="#switching-and-toggling-layers" aria-label="Permalink to &quot;Switching and Toggling Layers {#switching-and-toggling-layers}&quot;"></a></h2><p>These functions allow you to activate layers in various ways. Note that layers are not generally independent layouts -- multiple layers can be activated at once, and it&#39;s typical for layers to use <code>KC_TRNS</code> to allow keypresses to pass through to lower layers. When using momentary layer switching with MO(), LM(), TT(), or LT(), make sure to leave the key on the above layers transparent or it may not work as intended.</p><ul><li><code>DF(layer)</code> - switches the default layer. The default layer is the always-active base layer that other layers stack on top of. See below for more about the default layer. This might be used to switch from QWERTY to Dvorak layout. (Note that this is a temporary switch that only persists until the keyboard loses power. To modify the default layer in a persistent way requires deeper customization, such as calling the <code>set_single_persistent_default_layer</code> function inside of <a href="./custom_quantum_functions#programming-the-behavior-of-any-keycode">process_record_user</a>.)</li><li><code>MO(layer)</code> - momentarily activates <em>layer</em>. As soon as you let go of the key, the layer is deactivated.</li><li><code>LM(layer, mod)</code> - Momentarily activates <em>layer</em> (like <code>MO</code>), but with modifier(s) <em>mod</em> active. Only supports layers 0-15. The modifiers this keycode accept are prefixed with <code>MOD_</code>, not <code>KC_</code>. These modifiers can be combined using bitwise OR, e.g. <code>LM(_RAISE, MOD_LCTL | MOD_LALT)</code>.</li><li><code>LT(layer, kc)</code> - momentarily activates <em>layer</em> when held, and sends <em>kc</em> when tapped. Only supports layers 0-15.</li><li><code>OSL(layer)</code> - momentarily activates <em>layer</em> until the next key is pressed. See <a href="./one_shot_keys">One Shot Keys</a> for details and additional functionality.</li><li><code>TG(layer)</code> - toggles <em>layer</em>, activating it if it&#39;s inactive and vice versa</li><li><code>TO(layer)</code> - activates <em>layer</em> and de-activates all other layers (except your default layer). This function is special, 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. This is activated on keydown (as soon as the key is pressed).</li><li><code>TT(layer)</code> - Layer Tap-Toggle. If you hold the key down, <em>layer</em> is activated, and then is de-activated when you let go (like <code>MO</code>). If you repeatedly tap it, the layer will be toggled on or off (like <code>TG</code>). It needs 5 taps by default, but you can change this by defining <code>TAPPING_TOGGLE</code> -- for example, <code>#define TAPPING_TOGGLE 2</code> to toggle on just two taps.</li></ul><h3 id="caveats" tabindex="-1">Caveats <a class="header-anchor" href="#caveats" aria-label="Permalink to &quot;Caveats {#caveats}&quot;"></a></h3><p>Currently, the <code>layer</code> argument of <code>LT()</code> is limited to layers 0-15, and the <code>kc</code> argument to the <a href="./keycodes_basic">Basic Keycode set</a>, meaning you can&#39;t use keycodes like <code>LCTL()</code>, <code>KC_TILD</code>, or anything grea
const _hoisted_44 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_44);
}
const feature_layers = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
feature_layers as default
};