qmk_firmware/assets/features_tap_dance.md.PhmUSL7B.js

16 lines
112 KiB
JavaScript
Raw Permalink Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.B9AX-CPi.js";
const __pageData = JSON.parse('{"title":"Tap Dance: A Single Key Can Do 3, 5, or 100 Different Things","description":"","frontmatter":{},"headers":[],"relativePath":"features/tap_dance.md","filePath":"features/tap_dance.md","lastUpdated":null}');
const _sfc_main = { name: "features/tap_dance.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="tap-dance-a-single-key-can-do-3-5-or-100-different-things" tabindex="-1">Tap Dance: A Single Key Can Do 3, 5, or 100 Different Things <a class="header-anchor" href="#tap-dance-a-single-key-can-do-3-5-or-100-different-things" aria-label="Permalink to &quot;Tap Dance: A Single Key Can Do 3, 5, or 100 Different Things&quot;"></a></h1><h2 id="introduction" tabindex="-1">Introduction <a class="header-anchor" href="#introduction" aria-label="Permalink to &quot;Introduction {#introduction}&quot;"></a></h2><p>Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard&#39;s LEDs do a wild dance. That&#39;s just one example of what Tap Dance can do. It&#39;s one of the nicest community-contributed features in the firmware, conceived and created by <a href="https://github.com/algernon" target="_blank" rel="noreferrer">algernon</a> in <a href="https://github.com/qmk/qmk_firmware/pull/451" target="_blank" rel="noreferrer">#451</a>. Here&#39;s how algernon describes the feature:</p><p>With this feature one can specify keys that behave differently, based on the amount of times they have been tapped, and when interrupted, they get handled before the interrupter.</p><h2 id="how-to-use" tabindex="-1">How to Use Tap Dance <a class="header-anchor" href="#how-to-use" aria-label="Permalink to &quot;How to Use Tap Dance {#how-to-use}&quot;"></a></h2><p>First, you will need <code>TAP_DANCE_ENABLE = yes</code> in your <code>rules.mk</code>, because the feature is disabled by default. This adds a little less than 1k to the firmware size.</p><p>Optionally, you might want to set a custom <code>TAPPING_TERM</code> time by adding something like this in your <code>config.h</code> file:</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;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> TAPPING_TERM</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 175</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> TAPPING_TERM_PER_KEY</span></span></code></pre></div><p>The <code>TAPPING_TERM</code> time is the maximum time allowed between taps of your Tap Dance key, and is measured in milliseconds. For example, if you used the above <code>#define</code> statement and set up a Tap Dance key that sends <code>Space</code> on single-tap and <code>Enter</code> on double-tap, then this key will send <code>ENT</code> only if you tap this key twice in less than 175ms. If you tap the key, wait more than 175ms, and tap the key again you&#39;ll end up sending <code>SPC SPC</code> instead. The <code>TAPPING_TERM_PER_KEY</code> definition is only needed if you control the tapping term through a <a href="./../tap_hold#tapping_term">custom <code>get_tapping_term</code> function</a>, which may be needed because <code>TAPPING_TERM</code> affects not just tap-dance keys.</p><p>Next, you will want to define some tap-dance keys, which is easiest to do with the <code>TD()</code> macro. That macro takes a number which will later be used as an index into the <code>tap_dance_actions</code> array and turns it into a tap-dance keycode.</p><p>After this, you&#39;ll want to use the <code>tap_dance_actions</code> array to specify what actions shall be taken when a tap-dance key is in action. Currently, there are five possible options:</p><ul><li><code>ACTION_TAP_DANCE_DOUBLE(kc1, kc2)</code>: Sends the <code>kc1</code> keycode when tapped once, <code>kc2</code> otherwise. When the key is held, the appropriate keycode is registered: <code>kc1</code> when pressed and held, <code>kc2</code> when tapped once, then pressed and held.</li><li><code>ACTION_TAP_DANCE_LAYER_MOVE(kc, layer)</code>: Sends the
const _hoisted_66 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_66);
}
const tap_dance = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
tap_dance as default
};