mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-02-27 01:56:43 +00:00
16 lines
64 KiB
JavaScript
16 lines
64 KiB
JavaScript
|
import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js";
|
|||
|
const __pageData = JSON.parse('{"title":"Combos","description":"","frontmatter":{},"headers":[],"relativePath":"features/combo.md","filePath":"features/combo.md"}');
|
|||
|
const _sfc_main = { name: "features/combo.md" };
|
|||
|
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="combos" tabindex="-1">Combos <a class="header-anchor" href="#combos" aria-label="Permalink to "Combos""></a></h1><p>The Combo feature is a chording type solution for adding custom actions. It lets you hit multiple keys at once and produce a different effect. For instance, hitting <code>A</code> and <code>B</code> within the combo term would hit <code>ESC</code> instead, or have it perform even more complex tasks.</p><p>To enable this feature, you need to add <code>COMBO_ENABLE = yes</code> to your <code>rules.mk</code>.</p><p>Then, in your <code>keymap.c</code> file, you'll need to define a sequence of keys, terminated with <code>COMBO_END</code>, and a structure to list the combination of keys, and its resulting action.</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint16_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM test_combo1</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {KC_A, KC_B, COMBO_END};</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint16_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM test_combo2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {KC_C, KC_D, COMBO_END};</span></span>\n<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">combo_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> key_combos</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">[]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>\n<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> COMBO</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(test_combo1, KC_ESC),</span></span>\n<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> COMBO</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(test_combo2, </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">LCTL</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(KC_Z)),</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // keycodes with modifiers are possible too!</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span></code></pre></div><p>This will send "Escape" if you hit the A and B keys, and Ctrl+Z when you hit the C and D keys.</p><h2 id="advanced-keycodes-support" tabindex="-1">Advanced Keycodes Support <a class="header-anchor" href="#advanced-keycodes-support" aria-label="Permalink to "Advanced Keycodes Support""></a></h2><p>Advanced keycodes, such as <a href="./../mod_tap">Mod-Tap</a> and <a href="./tap_dance">Tap Dance</a> are also supported together with combos. If you use these advanced keycodes in your keymap, you will need to place the full keycode in the combo definition, e.g.:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint16_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PROGMEM test_combo1
|
|||
|
const _hoisted_81 = [
|
|||
|
_hoisted_1
|
|||
|
];
|
|||
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
return openBlock(), createElementBlock("div", null, _hoisted_81);
|
|||
|
}
|
|||
|
const combo = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|||
|
export {
|
|||
|
__pageData,
|
|||
|
combo as default
|
|||
|
};
|