qmk_firmware/assets/features_key_overrides.md.rVTP6kn9.js

16 lines
49 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":"Key Overrides","description":"","frontmatter":{},"headers":[],"relativePath":"features/key_overrides.md","filePath":"features/key_overrides.md"}');
const _sfc_main = { name: "features/key_overrides.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="key-overrides" tabindex="-1">Key Overrides <a class="header-anchor" href="#key-overrides" aria-label="Permalink to &quot;Key Overrides {#key-overrides}&quot;"></a></h1><p>Key overrides allow you to override modifier-key combinations to send a different modifier-key combination or perform completely custom actions. Don&#39;t want <code>shift</code> + <code>1</code> to type <code>!</code> on your computer? Use a key override to make your keyboard type something different when you press <code>shift</code> + <code>1</code>. The general behavior is like this: If <code>modifiers w</code> + <code>key x</code> are pressed, replace these keys with <code>modifiers y</code> + <code>key z</code> in the keyboard report.</p><p>You can use key overrides in a similar way to momentary layer/fn keys to activate custom keycodes/shortcuts, with a number of benefits: You completely keep the original use of the modifier keys, while being able to save space by removing fn keys from your keyboard. You can also easily configure <em>combinations of modifiers</em> to trigger different actions than individual modifiers, and much more. The possibilities are quite vast and this documentation contains a few examples for inspiration throughout.</p><h5 id="a-few-more-examples-to-get-started-you-could-use-key-overrides-to" tabindex="-1">A few more examples to get started: You could use key overrides to... <a class="header-anchor" href="#a-few-more-examples-to-get-started-you-could-use-key-overrides-to" aria-label="Permalink to &quot;A few more examples to get started: You could use key overrides to...&quot;"></a></h5><ul><li>Send <code>brightness up/down</code> when pressing <code>ctrl</code> + <code>volume up/down</code>.</li><li>Send <code>delete</code> when pressing <code>shift</code> + <code>backspace</code>.</li><li>Create custom shortcuts or change existing ones: E.g. Send <code>ctrl</code>+<code>shift</code>+<code>z</code> when <code>ctrl</code>+<code>y</code> is pressed.</li><li>Run custom code when <code>ctrl</code> + <code>alt</code> + <code>esc</code> is pressed.</li></ul><h2 id="setup" tabindex="-1">Setup <a class="header-anchor" href="#setup" aria-label="Permalink to &quot;Setup {#setup}&quot;"></a></h2><p>To enable this feature, you need to add <code>KEY_OVERRIDE_ENABLE = yes</code> to your <code>rules.mk</code>.</p><p>Then, in your <code>keymap.c</code> file, you&#39;ll need to define the array <code>key_overrides</code>, which defines all key overrides to be used. Each override is a value of type <code>key_override_t</code>. The array <code>key_overrides</code> is <code>NULL</code>-terminated and contains pointers to <code>key_override_t</code> values (<code>const key_override_t **</code>).</p><h2 id="creating-key-overrides" tabindex="-1">Creating Key Overrides <a class="header-anchor" href="#creating-key-overrides" aria-label="Permalink to &quot;Creating Key Overrides {#creating-key-overrides}&quot;"></a></h2><p>The <code>key_override_t</code> struct has many options that allow you to precisely tune your overrides. The full reference is shown below. Instead of manually creating a <code>key_override_t</code> value, it is recommended to use these dedicated initializers:</p><h4 id="ko-make-basic-modifiers-key-replacement" tabindex="-1"><code>ko_make_basic(modifiers, key, replacement)</code> <a class="header-anchor" href="#ko-make-basic-modifiers-key-replacement" aria-label="Permalink to &quot;`ko_make_basic(modifiers, key, replacement)`&quot;"></a></h4><p>Returns a <code>key_override_t</code>, which sends <code>replacement</code> (can be a key-modifier combination), when <code>key</code> and <code>modifiers</code> are all pressed down. This override still activates if any additional modifiers not specified in <code>modifiers</code> are also pressed down. See <code>ko_make_with_layers_and_negmods</code> to customize this behavior.</p><h4 id="ko-make-with-layers-modifiers-key-replacement-layers" tabindex="-1"><code>ko_make_with_layers(modifiers, key, replacement, la
const _hoisted_71 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_71);
}
const key_overrides = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
key_overrides as default
};