From 628e08c60661ca14313ecaef9205a1bf851b70bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismael=20Venegas=20Castell=C3=B3?= Date: Wed, 19 Jun 2019 00:43:07 -0500 Subject: [PATCH] [Keymap] Add new mod tap dances to Hacker Dvorak (#6155) --- .../ergodox_ez/keymaps/hacker_dvorak/config.h | 10 +++- .../keymaps/hacker_dvorak/gulpfile.js | 31 +++++----- .../keymaps/hacker_dvorak/hacker_dvorak.c | 26 ++++----- .../keycodes/aliases_definitions.c | 14 ++++- .../hacker_dvorak/keycodes/custom_keycodes.c | 1 - .../ergodox_ez/keymaps/hacker_dvorak/keymap.c | 9 +++ .../hacker_dvorak/layers/layers_definitions.c | 2 +- .../hacker_dvorak/leader/leader_setup.c | 13 ----- .../keymaps/hacker_dvorak/package.json | 2 +- .../ergodox_ez/keymaps/hacker_dvorak/rules.mk | 1 + .../tap_dance/mod_tap_layer_dances/dot_comm.c | 41 +++++++++++++ .../mod_tap_layer_dances/h_mouse_gui.c | 39 +++++++++++++ .../mod_tap_layer_dances/j_media_meh.c | 43 ++++++++++++++ .../mod_tap_layer_dances/k_numpad_hyper.c | 45 ++++++++++++++ .../mod_tap_layer_dances/m_chords_hyper.c | 45 ++++++++++++++ .../mod_tap_layer_dances/none_lead.c | 4 +- .../mod_tap_layer_dances/quot_dquot.c | 41 +++++++++++++ .../mod_tap_layer_dances/scln_coln.c | 43 ++++++++++++++ .../mod_tap_layer_dances/u_arrows_gui.c | 39 +++++++++++++ .../mod_tap_layer_dances/w_media_meh.c | 43 ++++++++++++++ .../tap_dance/tap_dance_actions.c | 40 +++++++------ .../hacker_dvorak/tap_dance/tap_dances.c | 58 +++++++++++++------ .../hacker_dvorak/user/layer_set_state_user.c | 2 +- 23 files changed, 506 insertions(+), 86 deletions(-) create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/dot_comm.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/h_mouse_gui.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/j_media_meh.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/k_numpad_hyper.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/m_chords_hyper.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/quot_dquot.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/scln_coln.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/u_arrows_gui.c create mode 100644 keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/w_media_meh.c diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h b/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h index e188d95d51..a0ba655ede 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h @@ -6,12 +6,15 @@ #undef TAPPING_TERM -#define TAPPING_TERM 200 +#define TAPPING_TERM 175 #undef DEBOUNCE -#define DEBOUNCE 10 +#define DEBOUNCE 15 #undef IGNORE_MOD_TAP_INTERRUPT +#define IGNORE_MOD_TAP_INTERRUPT + +#define RGB_DISABLE_WHEN_USB_SUSPENDED true #undef FORCE_NKRO #define FORCE_NKRO @@ -20,12 +23,13 @@ #define TAPPING_TOGGLE 5 #define LEADER_TIMEOUT 1000 -#define IGNORE_MOD_TAP_INTERRUPT #define PERMISSIVE_HOLD #define QMK_KEYS_PER_SCAN 4 #define DANCING_TERM 175 #define ONESHOT_TAP_TOGGLE 5 + +#undef ONESHOT_TIMEOUT #define ONESHOT_TIMEOUT 5000 #define COMBO_COUNT 4 diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/gulpfile.js b/keyboards/ergodox_ez/keymaps/hacker_dvorak/gulpfile.js index 23f19d18af..81a4e93fda 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/gulpfile.js +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/gulpfile.js @@ -1,19 +1,22 @@ -let gulp = require('gulp'); -let run = require('gulp-run-command').default; +const gulp = require('gulp'); +const run = require('gulp-run-command').default; -gulp.task('clean', run('rm -rf ../../../../.build')); +const ROOT_DIR = '../../../../'; +const BUILD_DIR = `${ROOT_DIR}.build`; +const HACKER_DVORAK_DIR = './**/*'; -gulp.task('build', ['clean'], run('make -C ../../../../ ergodox_ez:hacker_dvorak', { - ignoreErrors: true -})); +const CLEAN_CMD = `rm -rf ${BUILD_DIR}`; +const BUILD_CMD = `make -C ${ROOT_DIR} ergodox_ez:hacker_dvorak`; + +gulp.task('clean', run(CLEAN_CMD)); -gulp.task('watch', ['build'], () => { - gulp.watch([ - 'keymap.c', - 'config.h', - 'rules.mk', - ], ['build']); -}); +gulp.task('build', gulp.series('clean', run(BUILD_CMD, { + ignoreErrors: true +}))); + +gulp.task('watch', gulp.series('build', () => { + gulp.watch(HACKER_DVORAK_DIR, gulp.series('build')); +})); -gulp.task('default', ['watch']); +gulp.task('default', gulp.series('watch')); diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/hacker_dvorak.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/hacker_dvorak.c index 65878a67cb..71cf1053aa 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/hacker_dvorak.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/hacker_dvorak.c @@ -13,21 +13,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //------------------------+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+------------------------// // TAB | MOD TAP: ALT+SHIFT | MOD TAP: CTRL+ALT | MOD TAP: CTRL+SHIFT | P | Y | // // | | | | | | // - KC_TAB, TD(NONE_LEAD), TD(QUOT_DQUO), TD(DOT_COMM), ALL_T(KC_P), MEH_T(KC_Y), DYN_MACRO_PLAY1, // + KC_TAB, TD(NONE_LEAD), TD(QUOT_DQUO), TD(DOT_COMM), LCG_T(KC_P), LAG_T(KC_Y), DYN_MACRO_PLAY1, // // | LEAD | " | , | | | // - // | TAP DANCE: NONE | TAP DANCE: ' | TAP DANCE: . | MOD TAP: HYPER | MOD TAP: MEH | // + // | TAP DANCE: NONE | TAP DANCE: ' | TAP DANCE: . | MOD TAP: CTRL+GUI | MOD TAP: ALT+GUI | // //------------------------+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------| PLAY DYNAMIC MACRO 1 // - // | MOD TAP: ALT | MOD TAP: CTRL | LAYER TAP: SHIFT | LAYER TAP: ARROW KEYS | MOD TAP: GUI | // + // | MOD TAP: ALT | MOD TAP: CTRL | LAYER TAP: SHIFT | M TAP DANCE: ARROWS/GUI | MOD TAP: SHIFT+GUI | // // | | | | Ü | | // - TD(EQL_PLUS), ALT_T(KC_A), CTL_T(KC_O), SFT_T(KC_E), LT(ARROWS, KC_U), LGUI_T(KC_I), //-----------------------// + TD(EQL_PLUS), LALT_T(KC_A), LCTL_T(KC_O), LSFT_T(KC_E), TD(U_ARR_GUI), SGUI_T(KC_I), //-----------------------// // + | Á | Ó | É | Ú | Í | // // TAP DANCE: = | TAP DANCE: A | TAP DANCE: O | TAP DANCE: E | TAP DANCE: U | TAP DANCE: I | // //------------------------+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------| META // // STOP RECORDING | MOD TAP: GUI+SHIFT+ALT | Q | J | K | X | // // | | | | | | // - DYN_REC_STOP, TD(SCLN_COLN), SGUI_T(KC_Q), LT(MEDIA_FN, KC_J), LT(NUMPAD, KC_K), LCAG_T(KC_X), KC_LGUI, // + DYN_REC_STOP, TD(SCLN_COLN), LCAG_T(KC_Q), TD(J_MED_MEH), TD(K_NUM_HYP), LCSG_T(KC_X), KC_LGUI, // // | : | | | | | // - // DYNAMIC MACRO | TAP DANCE: ; | MOD TAP: SHIFT+GUI | LAYER TAP: MEDIA/F-KEYS | LAYER TAP: ATM NUMPAD | MOD TAP: CTL+ALT+GUI | // + // DYNAMIC MACRO | TAP DANCE: ; | MOD TAP: SHIFT+GUI | M TAP DANCE: MEDIA/MEH | M TAP DANCE: ATM/HYPER | MOD TAP: CTL+SHIFT+GUI | // //------------------------+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+------------------------// // LAYERS SWITCHER | APPLICATION MENU | | | // // | | | | SCROLL // @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //-------------------------+-------------------------+------------------------// // | | HOME // // | | // - /* SPACE | BACKSPACE */ KC_HOME, // + /* SPACE | BACKSPACE */ KC_HOME, // // | | // // | | // KC_SPC, KC_BSPC, //-----------------------// @@ -69,19 +69,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //------------------------+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+------------------------// // | | | | | | // // | | | | | | // - DYN_MACRO_PLAY2, MEH_T(KC_F), ALL_T(KC_G), C_S_T(KC_C), LCA_T(KC_R), LAS_T(KC_L), TD(SLSH_BSLS), // + DYN_MACRO_PLAY2, LAG_T(KC_F), LCG_T(KC_G), C_S_T(KC_C), LCA_T(KC_R), LAS_T(KC_L), TD(SLSH_BSLS), // // | | | | | | // // | | | | | | // // |-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+------------------------// // | | | | | | // // | | | | | | // - /*-----------------------*/ LGUI_T(KC_D), LT(MOUSE, KC_H), SFT_T(KC_T), CTL_T(KC_N), ALT_T(KC_S), TD(MINS_UNDS), // + /*-----------------------*/ SGUI_T(KC_D), TD(H_MOU_GUI), LSFT_T(KC_T), LCTL_T(KC_N), LALT_T(KC_S), TD(MINS_UNDS), // // | | | | | | // // | | | | | | // // |-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+------------------------// // | | | | | | // // | | | | | | // - KC_LGUI, LCAG_T(KC_B), LT(HYPER, KC_M), LT(MEDIA_FN, KC_W), SGUI_T(KC_V), LGAS_T(KC_Z), COMPOSE, // + KC_LGUI, LCSG_T(KC_B), TD(M_CHO_HYP), TD(W_MED_MEH), LCAG_T(KC_V), LASG_T(KC_Z), COMPOSE, // // | | | | | | // // | | | | | | ⎄ // //------------------------+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+------------------------// @@ -163,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_RBRC, KC_LEFT, KC_DOWN, KC_RIGHT, XXXXXXX, // right thumb - KC_MS_BTN5, MO(HYPER), + KC_MS_BTN5, MO(CHORD), KC_MS_BTN4, KC_MS_BTN3, KC_MS_BTN2, KC_MS_BTN1 ), @@ -295,10 +295,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // right thumb XXXXXXX, XXXXXXX, XXXXXXX, - RGB_GREEN, XXXXXXX, XXXXXXX + XXXXXXX, XXXXXXX, XXXXXXX ), - [HYPER] = LAYOUT_ergodox( + [CHORD] = LAYOUT_ergodox( // left hand XXXXXXX, HYPR(KC_F1), HYPR(KC_F2), HYPR(KC_F3), HYPR(KC_F4), HYPR(KC_F5), XXXXXXX, XXXXXXX, HYPR(KC_F6), HYPR(KC_F7), HYPR(KC_F8), HYPR(KC_F9), HYPR(KC_F10), XXXXXXX, diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/aliases_definitions.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/aliases_definitions.c index e5eba18202..323358357a 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/aliases_definitions.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/aliases_definitions.c @@ -1,5 +1,13 @@ -// Keycode aliases +// Compound keycode aliases #define SCTL(kc) LSFT(LCTL(kc)) // Modifier keys: SHIFT+CTRL+kc combination. -#define LGAS_T(kc) MT(MOD_LGUI | MOD_LALT | MOD_LSFT, kc) // Mod tap: kc when tapped, GUI+ALT+SHIFT when held. -#define LAS_T(kc) MT(MOD_LALT | MOD_LSFT, kc) // Mod tap: kc when tapped, ALT+SHIFT whin held. + +// Tap +#define LASG_T(kc) MT(MOD_LGUI | MOD_LALT | MOD_LSFT, kc) // Mod tap: kc when tapped, GUI+ALT+SHIFT when held. +#define LCSG_T(kc) MT(MOD_LGUI | MOD_LSFT | MOD_LCTL, kc) // Mod tap: kc when tapped, GUI+CTL+SHIFT when held. + +#define LCG_T(kc) MT(MOD_LCTL | MOD_LGUI, kc) // Mod tap: kc when tapped, CTL+GUI when held. +#define LAS_T(kc) MT(MOD_LALT | MOD_LSFT, kc) // Mod tap: kc when tapped, ALT+SHIFT when held. +#define LAG_T(kc) MT(MOD_LALT | MOD_LGUI, kc) // Mod tap: kc when tapped, ALT+GUI when held. + +// Others #define COMPOSE KC_RALT // Compose key (used to input characters like á, ñ, ü). diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/custom_keycodes.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/custom_keycodes.c index 368062172b..338910b53f 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/custom_keycodes.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/keycodes/custom_keycodes.c @@ -1,7 +1,6 @@ // Define custom user keycodes: enum custom_keycodes { PLACEHOLDER = SAFE_RANGE, // Can always be here. - RGB_GREEN, // To set default RGB layer as green once. MY_CUSTOM_MACRO, // Custom macro example. MY_OTHER_MACRO, // Custom macro example. DYNAMIC_MACRO_RANGE // Should always be the last. diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/keymap.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/keymap.c index af06d2bd81..e953f06de8 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/keymap.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/keymap.c @@ -9,6 +9,15 @@ #include "tap_dance/tap_dances.c" #include "user/matrix_scan_user.c" #include "tap_dance/mod_tap_layer_dances/none_lead.c" +#include "tap_dance/mod_tap_layer_dances/dot_comm.c" +#include "tap_dance/mod_tap_layer_dances/quot_dquot.c" +#include "tap_dance/mod_tap_layer_dances/scln_coln.c" +#include "tap_dance/mod_tap_layer_dances/u_arrows_gui.c" +#include "tap_dance/mod_tap_layer_dances/h_mouse_gui.c" +#include "tap_dance/mod_tap_layer_dances/j_media_meh.c" +#include "tap_dance/mod_tap_layer_dances/w_media_meh.c" +#include "tap_dance/mod_tap_layer_dances/k_numpad_hyper.c" +#include "tap_dance/mod_tap_layer_dances/m_chords_hyper.c" #include "tap_dance/tap_dance_actions.c" #include "keycodes/custom_keycodes.c" #include "dynamic_macro.h" // Includes dynamic macro definitions, needed *after* the custom keycodes. diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/layers/layers_definitions.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/layers/layers_definitions.c index f190e4f6f9..f252bc802b 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/layers/layers_definitions.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/layers/layers_definitions.c @@ -7,6 +7,6 @@ enum layers { // Hacker Dvorak keyboard layers: NUMPAD = 5, // * ATM style numpad with symbols and letters that should suffice to input any numeric literal. LAYERS = 6, // * Layer switcher used to change between DVORAK, PLOVER and GAMING layers. MEDIA_FN = 7, // * Media, RGB and function keys from F1 to F24 in symmetric fashion. - HYPER = 8, // * Hot keys layer (uses hyper + F1 .. F24) suitable for global shortcut tasks. + CHORD = 8, // * Hot keys layer (uses hyper + F1 .. F24) suitable for global shortcut tasks. FIRMWARE = 9 // * Layer with firmware related functionality, like the reset and EEPROM keys. }; diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c index 1e89c4bfca..c22670a05a 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c @@ -1,14 +1 @@ LEADER_EXTERNS(); - -void qk_leader_start(void) { - if (!leading) { - leading = true; - leader_time = timer_read(); - leader_sequence_size = 0; - leader_sequence[0] = 0; - leader_sequence[1] = 0; - leader_sequence[2] = 0; - leader_sequence[3] = 0; - leader_sequence[4] = 0; - } -} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/package.json b/keyboards/ergodox_ez/keymaps/hacker_dvorak/package.json index 116911e46b..173bcd5a86 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/package.json +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/package.json @@ -9,7 +9,7 @@ "author": "SalchiPapa", "license": "GPL-2.0", "dependencies": { - "gulp": "^3.9.1", + "gulp": "^4.0.0", "gulp-run-command": "0.0.9" } } diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk b/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk index 51a9ff0d49..aa13f98bd6 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk @@ -1,6 +1,7 @@ # Set any rules.mk overrides for your specific keymap here. # See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file +LINK_TIME_OPTIMIZATION_ENABLE = yes NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work TAP_DANCE_ENABLE = yes MOUSEKEY_ENABLE = yes # Mouse keys(+4700b). diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/dot_comm.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/dot_comm.c new file mode 100644 index 0000000000..cbfbcdaf9f --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/dot_comm.c @@ -0,0 +1,41 @@ +//instanalize an instance of 'tap' for the Dot - Comma tap dance. +static tap dot_comm_state = { + .is_press_action = true, + .state = 0 +}; + +void dot_comm_finished(qk_tap_dance_state_t *state, void *user_data) { + dot_comm_state.state = current_dance(state); + switch (dot_comm_state.state) { + case SINGLE_TAP: + register_code(KC_DOT); + break; + + case SINGLE_HOLD: + register_code(KC_LCTL); + register_code(KC_LSFT); + break; + + case DOUBLE_TAP: + register_code(KC_COMM); + break; + } +} + +void dot_comm_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (dot_comm_state.state) { + case SINGLE_TAP: + unregister_code(KC_DOT); + break; + + case SINGLE_HOLD: + unregister_code(KC_LCTL); + unregister_code(KC_LSFT); + break; + + case DOUBLE_TAP: + unregister_code(KC_COMM); + break; + } + dot_comm_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/h_mouse_gui.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/h_mouse_gui.c new file mode 100644 index 0000000000..76dda6eb32 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/h_mouse_gui.c @@ -0,0 +1,39 @@ +//instanalize an instance of 'tap' for the H - Mouse - Gui tap dance. +static tap h_mouse_gui_state = { + .is_press_action = true, + .state = 0 +}; + +void h_mouse_gui_finished(qk_tap_dance_state_t *state, void *user_data) { + h_mouse_gui_state.state = current_dance(state); + switch (h_mouse_gui_state.state) { + case SINGLE_TAP: + register_code(KC_H); + break; + + case SINGLE_HOLD: + layer_on(MOUSE); + break; + + case DOUBLE_HOLD: + register_code(KC_LGUI); + break; + } +} + +void h_mouse_gui_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (h_mouse_gui_state.state) { + case SINGLE_TAP: + unregister_code(KC_H); + break; + + case SINGLE_HOLD: + layer_off(MOUSE); + break; + + case DOUBLE_HOLD: + unregister_code(KC_LGUI); + break; + } + h_mouse_gui_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/j_media_meh.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/j_media_meh.c new file mode 100644 index 0000000000..daf7be1f6f --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/j_media_meh.c @@ -0,0 +1,43 @@ +//instanalize an instance of 'tap' for the J - Media - Meh tap dance. +static tap j_media_meh_state = { + .is_press_action = true, + .state = 0 +}; + +void j_media_meh_finished(qk_tap_dance_state_t *state, void *user_data) { + j_media_meh_state.state = current_dance(state); + switch (j_media_meh_state.state) { + case SINGLE_TAP: + register_code(KC_J); + break; + + case SINGLE_HOLD: + layer_on(MEDIA_FN); + break; + + case DOUBLE_HOLD: + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_LALT); + break; + } +} + +void j_media_meh_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (j_media_meh_state.state) { + case SINGLE_TAP: + unregister_code(KC_J); + break; + + case SINGLE_HOLD: + layer_off(MEDIA_FN); + break; + + case DOUBLE_HOLD: + unregister_code(KC_LCTL); + unregister_code(KC_LSFT); + unregister_code(KC_LALT); + break; + } + j_media_meh_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/k_numpad_hyper.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/k_numpad_hyper.c new file mode 100644 index 0000000000..609e9f5539 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/k_numpad_hyper.c @@ -0,0 +1,45 @@ +//instanalize an instance of 'tap' for the K - Numpad - Hyper tap dance. +static tap k_numpad_hyper_state = { + .is_press_action = true, + .state = 0 +}; + +void k_numpad_hyper_finished(qk_tap_dance_state_t *state, void *user_data) { + k_numpad_hyper_state.state = current_dance(state); + switch (k_numpad_hyper_state.state) { + case SINGLE_TAP: + register_code(KC_K); + break; + + case SINGLE_HOLD: + layer_on(NUMPAD); + break; + + case DOUBLE_HOLD: + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_LALT); + register_code(KC_LGUI); + break; + } +} + +void k_numpad_hyper_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (k_numpad_hyper_state.state) { + case SINGLE_TAP: + unregister_code(KC_K); + break; + + case SINGLE_HOLD: + layer_off(NUMPAD); + break; + + case DOUBLE_HOLD: + unregister_code(KC_LCTL); + unregister_code(KC_LSFT); + unregister_code(KC_LALT); + unregister_code(KC_LGUI); + break; + } + k_numpad_hyper_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/m_chords_hyper.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/m_chords_hyper.c new file mode 100644 index 0000000000..e7df3aef14 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/m_chords_hyper.c @@ -0,0 +1,45 @@ +//instanalize an instance of 'tap' for the M - Chords - Hyper tap dance. +static tap m_chords_hyper_state = { + .is_press_action = true, + .state = 0 +}; + +void m_chords_hyper_finished(qk_tap_dance_state_t *state, void *user_data) { + m_chords_hyper_state.state = current_dance(state); + switch (m_chords_hyper_state.state) { + case SINGLE_TAP: + register_code(KC_M); + break; + + case SINGLE_HOLD: + layer_on(CHORD); + break; + + case DOUBLE_HOLD: + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_LALT); + register_code(KC_LGUI); + break; + } +} + +void m_chords_hyper_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (m_chords_hyper_state.state) { + case SINGLE_TAP: + unregister_code(KC_M); + break; + + case SINGLE_HOLD: + layer_off(CHORD); + break; + + case DOUBLE_HOLD: + unregister_code(KC_LCTL); + unregister_code(KC_LSFT); + unregister_code(KC_LALT); + unregister_code(KC_LGUI); + break; + } + m_chords_hyper_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/none_lead.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/none_lead.c index 6debc1ce45..0ba31cec81 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/none_lead.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/none_lead.c @@ -1,7 +1,7 @@ //instanalize an instance of 'tap' for the None - Lead tap dance. static tap none_lead_state = { - .is_press_action = true, - .state = 0 + .is_press_action = true, + .state = 0 }; void none_lead_finished(qk_tap_dance_state_t *state, void *user_data) { diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/quot_dquot.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/quot_dquot.c new file mode 100644 index 0000000000..ac6da9e00e --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/quot_dquot.c @@ -0,0 +1,41 @@ +//instanalize an instance of 'tap' for the Quote - Double Quote tap dance. +static tap quot_dquot_state = { + .is_press_action = true, + .state = 0 +}; + +void quot_dquot_finished(qk_tap_dance_state_t *state, void *user_data) { + quot_dquot_state.state = current_dance(state); + switch (quot_dquot_state.state) { + case SINGLE_TAP: + register_code(KC_QUOT); + break; + + case SINGLE_HOLD: + register_code(KC_LCTL); + register_code(KC_LALT); + break; + + case DOUBLE_TAP: + register_code16(KC_DQUO); + break; + } +} + +void quot_dquot_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (quot_dquot_state.state) { + case SINGLE_TAP: + unregister_code(KC_QUOT); + break; + + case SINGLE_HOLD: + unregister_code(KC_LCTL); + unregister_code(KC_LALT); + break; + + case DOUBLE_TAP: + unregister_code16(KC_DQUO); + break; + } + quot_dquot_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/scln_coln.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/scln_coln.c new file mode 100644 index 0000000000..513c932663 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/scln_coln.c @@ -0,0 +1,43 @@ +//instanalize an instance of 'tap' for the Semicolon - Colon tap dance. +static tap scln_coln_state = { + .is_press_action = true, + .state = 0 +}; + +void scln_coln_finished(qk_tap_dance_state_t *state, void *user_data) { + scln_coln_state.state = current_dance(state); + switch (scln_coln_state.state) { + case SINGLE_TAP: + register_code(KC_SCLN); + break; + + case SINGLE_HOLD: + register_code(KC_LALT); + register_code(KC_LSFT); + register_code(KC_LGUI); + break; + + case DOUBLE_TAP: + register_code16(KC_COLN); + break; + } +} + +void scln_coln_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (scln_coln_state.state) { + case SINGLE_TAP: + unregister_code(KC_SCLN); + break; + + case SINGLE_HOLD: + unregister_code(KC_LALT); + unregister_code(KC_LSFT); + unregister_code(KC_LGUI); + break; + + case DOUBLE_TAP: + unregister_code16(KC_COLN); + break; + } + scln_coln_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/u_arrows_gui.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/u_arrows_gui.c new file mode 100644 index 0000000000..e57502a790 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/u_arrows_gui.c @@ -0,0 +1,39 @@ +//instanalize an instance of 'tap' for the U - Arrows - Gui tap dance. +static tap u_arrows_gui_state = { + .is_press_action = true, + .state = 0 +}; + +void u_arrows_gui_finished(qk_tap_dance_state_t *state, void *user_data) { + u_arrows_gui_state.state = current_dance(state); + switch (u_arrows_gui_state.state) { + case SINGLE_TAP: + register_code(KC_U); + break; + + case SINGLE_HOLD: + layer_on(ARROWS); + break; + + case DOUBLE_HOLD: + register_code(KC_LGUI); + break; + } +} + +void u_arrows_gui_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (u_arrows_gui_state.state) { + case SINGLE_TAP: + unregister_code(KC_U); + break; + + case SINGLE_HOLD: + layer_off(ARROWS); + break; + + case DOUBLE_HOLD: + unregister_code(KC_LGUI); + break; + } + u_arrows_gui_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/w_media_meh.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/w_media_meh.c new file mode 100644 index 0000000000..c26980526c --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/w_media_meh.c @@ -0,0 +1,43 @@ +//instanalize an instance of 'tap' for the W - Media - Meh tap dance. +static tap w_media_meh_state = { + .is_press_action = true, + .state = 0 +}; + +void w_media_meh_finished(qk_tap_dance_state_t *state, void *user_data) { + w_media_meh_state.state = current_dance(state); + switch (w_media_meh_state.state) { + case SINGLE_TAP: + register_code(KC_W); + break; + + case SINGLE_HOLD: + layer_on(MEDIA_FN); + break; + + case DOUBLE_HOLD: + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_LALT); + break; + } +} + +void w_media_meh_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (w_media_meh_state.state) { + case SINGLE_TAP: + unregister_code(KC_W); + break; + + case SINGLE_HOLD: + layer_off(MEDIA_FN); + break; + + case DOUBLE_HOLD: + unregister_code(KC_LCTL); + unregister_code(KC_LSFT); + unregister_code(KC_LALT); + break; + } + w_media_meh_state.state = 0; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c index 550e1f7c84..59e3e2b0dc 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dance_actions.c @@ -1,20 +1,26 @@ // Register the double tap dances: qk_tap_dance_action_t tap_dance_actions[] = { - [EQL_PLUS] = ACTION_TAP_DANCE_DOUBLE(KC_EQL, KC_PLUS), - [MINS_UNDS] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, KC_UNDS), - [SLSH_BSLS] = ACTION_TAP_DANCE_DOUBLE(KC_SLSH, KC_BSLS), - [GRV_TILD] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, KC_TILD), - [QUOT_DQUO] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_DQUO), - [SCLN_COLN] = ACTION_TAP_DANCE_DOUBLE(KC_SCLN, KC_COLN), - [ASTR_CIRC] = ACTION_TAP_DANCE_DOUBLE(KC_ASTR, KC_CIRC), - [APMR_PIPE] = ACTION_TAP_DANCE_DOUBLE(KC_AMPR, KC_PIPE), - [EXLM_QUES] = ACTION_TAP_DANCE_DOUBLE(KC_EXLM, KC_QUES), - [HASH_PERC] = ACTION_TAP_DANCE_DOUBLE(KC_HASH, KC_PERC), - [AT_DLR] = ACTION_TAP_DANCE_DOUBLE(KC_AT, KC_DLR), - [LPRN_LBRC] = ACTION_TAP_DANCE_DOUBLE(KC_LPRN, KC_LBRC), - [RPRN_RBRC] = ACTION_TAP_DANCE_DOUBLE(KC_RPRN, KC_RBRC), - [LCBR_LABK] = ACTION_TAP_DANCE_DOUBLE(KC_LCBR, KC_LABK), - [RCBR_RABK] = ACTION_TAP_DANCE_DOUBLE(KC_RCBR, KC_RABK), - [DOT_COMM] = ACTION_TAP_DANCE_DOUBLE(KC_DOT, KC_COMM), - [NONE_LEAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, none_lead_finished, none_lead_reset, DANCING_TERM) + [EQL_PLUS] = ACTION_TAP_DANCE_DOUBLE(KC_EQL, KC_PLUS), + [MINS_UNDS] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, KC_UNDS), + [SLSH_BSLS] = ACTION_TAP_DANCE_DOUBLE(KC_SLSH, KC_BSLS), + [GRV_TILD] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, KC_TILD), + [ASTR_CIRC] = ACTION_TAP_DANCE_DOUBLE(KC_ASTR, KC_CIRC), + [APMR_PIPE] = ACTION_TAP_DANCE_DOUBLE(KC_AMPR, KC_PIPE), + [EXLM_QUES] = ACTION_TAP_DANCE_DOUBLE(KC_EXLM, KC_QUES), + [HASH_PERC] = ACTION_TAP_DANCE_DOUBLE(KC_HASH, KC_PERC), + [AT_DLR] = ACTION_TAP_DANCE_DOUBLE(KC_AT, KC_DLR), + [LPRN_LBRC] = ACTION_TAP_DANCE_DOUBLE(KC_LPRN, KC_LBRC), + [RPRN_RBRC] = ACTION_TAP_DANCE_DOUBLE(KC_RPRN, KC_RBRC), + [LCBR_LABK] = ACTION_TAP_DANCE_DOUBLE(KC_LCBR, KC_LABK), + [RCBR_RABK] = ACTION_TAP_DANCE_DOUBLE(KC_RCBR, KC_RABK), + [SCLN_COLN] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, scln_coln_finished, scln_coln_reset, DANCING_TERM), + [QUOT_DQUO] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, quot_dquot_finished, quot_dquot_reset, DANCING_TERM), + [DOT_COMM] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, dot_comm_finished, dot_comm_reset, DANCING_TERM), + [NONE_LEAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, none_lead_finished, none_lead_reset, DANCING_TERM), + [U_ARR_GUI] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, u_arrows_gui_finished, u_arrows_gui_reset, DANCING_TERM), + [H_MOU_GUI] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, h_mouse_gui_finished, h_mouse_gui_reset, DANCING_TERM), + [J_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, j_media_meh_finished, j_media_meh_reset, DANCING_TERM), + [W_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, w_media_meh_finished, w_media_meh_reset, DANCING_TERM), + [K_NUM_HYP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, k_numpad_hyper_finished, k_numpad_hyper_reset, DANCING_TERM), + [M_CHO_HYP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, m_chords_hyper_finished, m_chords_hyper_reset, DANCING_TERM), }; diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dances.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dances.c index 3d44698729..d05a71d7e5 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dances.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/tap_dances.c @@ -4,71 +4,95 @@ // Mod tap dances: // | | | | | // enum tap_dances { //--------------------------------------------------------------------------------------------// // | | | | | // - EQL_PLUS = 0, // = | + | | | | // + EQL_PLUS = 0, // = | | + | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - MINS_UNDS = 1, // - | _ | | | | // + MINS_UNDS = 1, // - | | _ | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - SLSH_BSLS = 2, // / | \ | | | | // + SLSH_BSLS = 2, // / | | \ | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - GRV_TILD = 3, // ` | ~ | | | | // + GRV_TILD = 3, // ` | | ~ | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - QUOT_DQUO = 4, // ' | " | | | | // + QUOT_DQUO = 4, // ' | CTRL+ALT | " | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - SCLN_COLN = 5, // ; | : | | | | // + SCLN_COLN = 5, // ; |ALT+SHIFT+META | : | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - ASTR_CIRC = 6, // * | ^ | | | | // + ASTR_CIRC = 6, // * | | ^ | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - APMR_PIPE = 7, // & | | | | | | // + APMR_PIPE = 7, // & | | | | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - EXLM_QUES = 8, // ! | ? | | | | // + EXLM_QUES = 8, // ! | | ? | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - HASH_PERC = 9, // # | % | | | | // + HASH_PERC = 9, // # | | % | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - AT_DLR = 10, // @ | $ | | | | // + AT_DLR = 10, // @ | | $ | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - LPRN_LBRC = 11, // ( | [ | | | | // + LPRN_LBRC = 11, // ( | | [ | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - RPRN_RBRC = 12, // ) | ] | | | | // + RPRN_RBRC = 12, // ) | | ] | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - LCBR_LABK = 13, // { | < | | | | // + LCBR_LABK = 13, // { | | < | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - RCBR_RABK = 14, // } | > | | | | // + RCBR_RABK = 14, // } | | > | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - DOT_COMM = 15, // . | , | | | | // + DOT_COMM = 15, // . | CTRL+SHIFT | , | | | // // | | | | | // //--------------------------------------------------------------------------------------------// // | | | | | // - NONE_LEAD = 16, // NONE | ALT+SHIFT | LEAD | | | // + NONE_LEAD = 16, // NONE | ALT+SHIFT | LEAD | | | // + // | | | | | // + //--------------------------------------------------------------------------------------------// + // | | | | | // + U_ARR_GUI = 17, // U | ARROWS | | GUI | | // + // | | | | | // + //--------------------------------------------------------------------------------------------// + // | | | | | // + H_MOU_GUI = 18, // H | MOUSE | | GUI | | // + // | | | | | // + //--------------------------------------------------------------------------------------------// + // | | | | | // + J_MED_MEH = 19, // J | MEDIA_FN | | MEH | | // + // | | | | | // + //--------------------------------------------------------------------------------------------// + // | | | | | // + W_MED_MEH = 20, // W | MEDIA_FN | | MEH | | // + // | | | | | // + //--------------------------------------------------------------------------------------------// + // | | | | | // + K_NUM_HYP = 21, // K | NUMPAD | | HYPER | | // + // | | | | | // + //--------------------------------------------------------------------------------------------// + // | | | | | // + M_CHO_HYP = 22, // M | CHORD | | HYPER | | // // | | | | | // //--------------------------------------------------------------------------------------------// }; diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c index e2eeed6fa9..c0b3b9c995 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c @@ -91,7 +91,7 @@ uint32_t layer_state_set_user(uint32_t state) { break; - case HYPER: + case CHORD: rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2);