Merge pull request #1368 from shieldsd/master
Additional tap dance keys/functions for planck/keymap/dshieldsdaktil_manuform
commit
05b0075391
|
@ -16,17 +16,37 @@
|
|||
#define MOUSEKEY_MAX_SPEED 7
|
||||
#define MOUSEKEY_WHEEL_DELAY 0
|
||||
|
||||
// dynamic macro keys
|
||||
#define DM_PLAY DYN_MACRO_PLAY1
|
||||
#define DM_STRT DYN_REC_START1
|
||||
#define DM_STOP DYN_REC_STOP
|
||||
|
||||
// one-shot layer keys
|
||||
#define OSL_RSE OSL(RSE)
|
||||
#define OSL_LWR OSL(LWR)
|
||||
#define OSL_FUN OSL(FUN)
|
||||
|
||||
// one-shot modifier keys
|
||||
#define OSM_CTL OSM(MOD_LCTL)
|
||||
#define OSM_ALT OSM(MOD_LALT)
|
||||
#define OSM_SFT OSM(MOD_LSFT)
|
||||
|
||||
// tap dance keys
|
||||
#define TD_SCLN TD(TDK_SCLN)
|
||||
#define TD_COMM TD(TDK_COMM)
|
||||
#define TD_DOT TD(TDK_DOT)
|
||||
#define TD_SLSH TD(TDK_SLSH)
|
||||
|
||||
#define ACTION_TAP_DANCE_FN_KEYCODE(user_fn, kc) { \
|
||||
.fn = { NULL, user_fn, NULL }, \
|
||||
.user_data = (void *)&((qk_tap_dance_pair_t) { kc, 0 }) \
|
||||
}
|
||||
|
||||
#define ACTION_TAP_DANCE_FN_KEYCODE2(user_fn, kc1, kc2) { \
|
||||
.fn = { NULL, user_fn, NULL }, \
|
||||
.user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }) \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ extern keymap_config_t keymap_config;
|
|||
|
||||
enum planck_layers { DEF, LWR, RSE, FUN };
|
||||
enum planck_keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE };
|
||||
enum tap_dance_keys { TD_SCLN };
|
||||
enum tap_dance_keys { TDK_SCLN, TDK_COMM, TDK_DOT, TDK_SLSH };
|
||||
|
||||
#include "dynamic_macro.h"
|
||||
|
||||
|
@ -26,8 +26,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[DEF] = {
|
||||
{KC_Q, KC_W, KC_E, KC_R, KC_T, KC_ESC, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P},
|
||||
{KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, TD(TD_SCLN)},
|
||||
{KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH},
|
||||
{KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, TD_SCLN},
|
||||
{KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, TD_COMM, TD_DOT, TD_SLSH},
|
||||
{OSM_CTL, KC_LGUI, OSM_ALT, OSL_FUN, OSL_LWR, KC_SPC, KC_SPC, OSL_RSE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
|
||||
},
|
||||
/* Lower
|
||||
|
@ -43,8 +43,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[LWR] = {
|
||||
{KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN},
|
||||
{S(KC_GRV), _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, _______, S(KC_LBRC), S(KC_RBRC)},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, S(KC_QUOT), S(KC_BSLS)},
|
||||
{KC_TILD, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, _______, KC_LCBR, KC_RCBR},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DQUO, KC_PIPE},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END}
|
||||
},
|
||||
/* Raise
|
||||
|
@ -84,8 +84,39 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
};
|
||||
|
||||
void tap(uint16_t keycode) {
|
||||
register_code16(keycode);
|
||||
unregister_code16(keycode);
|
||||
};
|
||||
|
||||
void tap_dance_triple(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
|
||||
uint16_t keycode = pair->kc1;
|
||||
|
||||
switch(state->count) {
|
||||
case 2:
|
||||
register_code(KC_LSFT);
|
||||
tap(keycode);
|
||||
unregister_code(KC_LSFT);
|
||||
break;
|
||||
case 3:
|
||||
if (pair->kc2) {
|
||||
keycode = pair->kc2;
|
||||
}
|
||||
tap(keycode);
|
||||
tap(keycode);
|
||||
break;
|
||||
default:
|
||||
tap(keycode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_SCLN] = ACTION_TAP_DANCE_DOUBLE(KC_SCLN, S(KC_SCLN)) // once for semi-colon, twice for colon
|
||||
[TDK_SCLN] = ACTION_TAP_DANCE_FN_KEYCODE2(tap_dance_triple, KC_SCLN, KC_COLN),
|
||||
[TDK_COMM] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_COMM),
|
||||
[TDK_DOT] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_DOT),
|
||||
[TDK_SLSH] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_SLSH)
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
Loading…
Reference in New Issue