<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // No need to register KC_LALT because it's already active.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // The Alt modifier will apply on this KC_TAB.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span></code></pre></div><h3id="shift-backspace-for-delete"tabindex="-1">Shift + Backspace for Delete <aclass="header-anchor"href="#shift-backspace-for-delete"aria-label="Permalink to "Shift + Backspace for Delete {#shift-backspace-for-delete}""></a></h3><p>Advanced example where the original behaviour of shift is cancelled when chorded with <code>KC_BSPC</code> and is instead fully replaced by <code>KC_DEL</code>. Two main variables are created to make this work well: <code>mod_state</code> and <code>delkey_registered</code>. The first one stores the modifier state and is used to restore it after registering <code>KC_DEL</code>. The second variable is a boolean variable (true or false) which keeps track of the status of <code>KC_DEL</code> to manage the release of the whole Backspace/Delete key correctly.</p><p>As opposed to the previous example, this doesn't use strict modifier checking. Pressing <code>KC_BSPC</code> while one or two shifts are active is enough to trigger this custom code, regardless of the state of other modifiers. That approach offers some perks: Ctrl+Shift+Backspace lets us delete the next word (Ctrl+Delete) and Ctrl+Alt+Shift+Backspace lets us execute the Ctrl+Alt+Del keyboard shortcut.</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Initialize variable holding the binary</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// representation of active modifiers.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Store the current modifier state in the variable for later reference</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Update the boolean variable to reflect the status of KC_DEL</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Reapplying modifier state so that the held shift key(s)</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // still work even after having tapped the Backspace/Delete key.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } </span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">else</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // on release of KC_BSPC</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // In case KC_DEL is still being sent even after the release of KC_BSPC</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Let QMK process the KC_BSPC keycode as usual outside of shift</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">};</span></span></code></pre></div><p>Alternatively, this can be done with <ahref="./features/key_overrides#simple-example">Key Overrides</a>.</p><h1id="advanced-topics"tabindex="-1">Advanced topics <aclass="header-anchor"href="#advanced-topics"aria-label="Permalink to "Advanced topics {#advanced-topics}""></a></h1><p>This page used to encompass a large set of features. We have moved many sections that used to be part of this page to their own pages. Everything below this point is simply a redirect so that people following old links on the web find what they're looking for.</p><h2id="switching-and-toggling-layers"tabindex="-1">Layers <aclass="header-anchor"href="#switching-and-toggling-layers"aria-label="Permalink to "Layers {#switching-and-toggling-layers}""></a></h2><ul><li><ahref="./feature_layers">Layers</a></li></ul><h2id="mod-tap"tabindex="-1">Mod-Tap <aclass="header-anchor"href="#mod-tap"aria-label="Permalink to "Mod-Tap {#mod-tap}""></a></h2><ul><li><ahref="./mod_tap">Mod-Tap</a></li></ul><h2id="one-shot-keys"tabindex="-1">One Shot Keys <aclass="header-anchor"href="#one-shot-keys"aria-label="Permalink to "One Shot Keys {#one-shot-keys}""></a></h2><ul><li><ahref="./one_shot_keys">One Shot Keys</a></li></ul><h2id="tap-hold-configuration-options"tabindex="-1">Tap-Hold Configuration Options <aclass="header-anchor"href="#tap-hold-configuration-options"aria-label="Permalink to "Tap-Hold Configuration Options {#tap-hold-configuration-options}""></a></h2><ul><li><ahref="./tap_hold">Tap-Hold Configuration Options</a></li></ul><h2id="key-overrides"tabindex="-1">Key Overrides <aclass="header-anchor"href="#key-overrides"aria-label="Permalink to "Key Overrides {#key-overrides}""></a></h2><ul><li><ahref="./features/key_overrides">Key Overrides</a></li></ul></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-09de1c0f><!--[--><!--]--><divclass="edit-info"data-v-09de1c0f><divclass="edit-link"data-v-09de1c0f><aclass="VPLink link vp-external-link-icon no-icon edit-link-button"href="https://github.com/qmk/qmk_firmware/edit/master/docs/feature_advanced_keycodes.md"target="_blank"rel="noreferrer"data-v-09de1c0f><!--[--><spanclass="vpi-square-pen edit-link-icon"data-v-09de1c0f></span> Edit this page<!--]--></a></div><!----></div><navclass="prev-next"data-v-09de1c0f><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link prev"href="/reference_keymap_extras"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Previous page</span><spanclass="title"data-v-09de1c0f>Language-Specific Keycodes</span><!--]--></a></div><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link next"href="/quantum_keycodes"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Next page</span><spanclass="title"data-v-09de1c0f>Quantum Keycodes</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>