X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=docs%2Ffeature_tap_dance.md;h=f2f2749440a218cc46d7b2c68e1363e299d1fbd7;hb=fd698c43d78ebbc42c1eb2bec74078b791616ad1;hp=99298fbda83bb66ee14ab5217ef6fd3bd0f290cd;hpb=a87b36d791dc58b9dc4ab95dbcbfa299e9d69287;p=qmk_firmware.git diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md index 99298fbda..f2f274944 100644 --- a/docs/feature_tap_dance.md +++ b/docs/feature_tap_dance.md @@ -26,6 +26,8 @@ This array specifies what actions shall be taken when a tap-dance key is in acti The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. +!> Keep in mind that only [basic keycodes](keycodes_basic.md) are supported here. Custom keycodes are not supported. + And that's the bulk of it! And now, on to the explanation of how it works! @@ -183,35 +185,15 @@ Below is a specific example: ## Setup -You will need a few things that can be used for 'Quad Function Tap-Dance'. The suggested setup is to create a user directory for yourself. This directory will contain rules.mk `.c` and `.h`. This directory should be called ``, and located in the top level `users` directory. There should already be a few examples to look at there. +You will need a few things that can be used for 'Quad Function Tap-Dance'. -### In `/qmk_firmware/users//rules.mk` +You'll need to add these to the top of your `keymap.c` file, before your keymap. -Put the following: ```c -TAP_DANCE_ENABLE = yes -SRC += your_name.c -``` - -Pretty simple. It is a nice way to keep some rules common on all your keymaps. - - -### In `/qmk_firmware/users//.h` - -You will need a few things in this file: - -```c -#ifndef YOUR_NAME -#define YOUR_NAME - -#include "quantum.h" -#include "process_keycode/process_tap_dance.h" - - typedef struct { bool is_press_action; int state; -} xtap; +} tap; enum { SINGLE_TAP = 1, @@ -225,27 +207,21 @@ enum { //Tap dance enums enum { - CTL_X = 0, - SOME_OTHER_DANCE -} + X_CTL = 0, + SOME_OTHER_DANCE +}; int cur_dance (qk_tap_dance_state_t *state); //for the x tap dance. Put it here so it can be used in any keymap void x_finished (qk_tap_dance_state_t *state, void *user_data); void x_reset (qk_tap_dance_state_t *state, void *user_data); -``` -### In `/qmk_firmware/users//.c` +``` -And then in your user's `.c` file you implement the functions above: +Now, at the bottom of your `keymap.c` file, you'll need to add the following: ```c -#include "gordon.h" -#include "quantum.h" -#include "action.h" -#include "process_keycode/process_tap_dance.h" - /* Return an integer that corresponds to what kind of tap dance should be executed. * * How to figure out tap dance state: interrupted and pressed. @@ -335,4 +311,6 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; ``` -And then simply use TD(X_CTL) anywhere in your keymap. +And then simply use `TD(X_CTL)` anywhere in your keymap. + +If you want to implement this in your userspace, then you may want to check out how [DanielGGordon](https://github.com/qmk/qmk_firmware/tree/master/users/gordon) has implemented this in their userspace.