From 15297bcfce016b8f03c2004b3db5a26e38cf994e Mon Sep 17 00:00:00 2001 From: Dusty Pomerleau Date: Wed, 13 Feb 2019 11:46:40 +1100 Subject: [PATCH] [Keymap] Add Minidox keymap by dustypomerleau (#5101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add dusty keymap * change keymap folder to match my github username * initial keymap completed in comments only * layout without NAV completed in comments only * disable Command to prevent interference with Space Cadet keys * switch _ and \ in the symbol layer * Layers complete through _NAV * add thumb keys to _NAV * complete _NUM * all layouts complete; still needs `process_user_record()` * completed first draft of keymap; still needs config.h to match * corrected keycodes for Mac macro-volume keys * fix Mac mute keycode * add missing Mac keycodes for previous and next track * placeholder for qwerty layout, not yet completed; remove unnecessary breaks; add todos * eliminate Preonic branch before switching to Minidox branch: • delete dustypomerleau Preonic keymap folder • complete keymap.c (QWERTY layer, vanilla numbers layer) TODO: • add preferences to config.h • complete the README * edit commented keymap diagrams for clarity in dual function keys * define initial config.h and add rules.mk for mouse key support * fix redundant line after implementation of tap_code() * fixed key_timer declaration, added README and rules * formatting of keymap * add CTPC to config * cycle thumb keys to favor center position * modify config.h for temporary Pro Micro compatibility * remove superfluous call to use serial; homebrewed mod tap keys are still broken with OSL * merge _SYS and _MEDIA on new Z_SYS key * ALT_OP example of new MT macro complete * initial narze-inspired MT fixes in PRU * add (currently superfluous) custom keycode for the _SYS layer * rudimentary `OSL` symbol macros that immediately register the mod and fail to reset the oneshot layer, but do output the proper keys—fix both of these things * remove permissive hold to improve tapping performance * remove calls to `clear_oneshot_layer_state()`, as they have no effect inside `process_record_user()`. Tapdance appears to be the way forward. * final commit before tapdance code; correct layout in comments * initial tapdance code for shifted mod taps * add numeric and ergo NUM layers and pinky shifts for keycuts * add TD() wrappers to tapdance codes and clean up commented layout guides * add faux return to cur_dance to allow compilation - TODO: research what the default clause should be in cur_dance * update commented schematics for better readability * add backspace and delete to lockable layers, Z_SYS -> SYS_Z for consistency, fix schematic errors * add `DOUBLE_SINGLE_TAP` to tapdance cases to allow doubling of the single tap character without waiting tapping term * remove reduced oneshot tapping toggles * update README * newline tweak :) * Update keyboards/minidox/keymaps/dustypomerleau/keymap.c Co-Authored-By: dustypomerleau * Update keyboards/minidox/keymaps/dustypomerleau/config.h Co-Authored-By: dustypomerleau * Update keyboards/minidox/keymaps/dustypomerleau/config.h Co-Authored-By: dustypomerleau * Update keyboards/minidox/keymaps/dustypomerleau/config.h Co-Authored-By: dustypomerleau * Update keyboards/minidox/keymaps/dustypomerleau/config.h Co-Authored-By: dustypomerleau * remove `PREVENT_STUCK_MODIFIERS`, as this is default behavior --- .../minidox/keymaps/dustypomerleau/README.md | 28 + .../minidox/keymaps/dustypomerleau/config.h | 26 + .../minidox/keymaps/dustypomerleau/keymap.c | 489 ++++++++++++++++++ .../minidox/keymaps/dustypomerleau/rules.mk | 4 + 4 files changed, 547 insertions(+) create mode 100644 keyboards/minidox/keymaps/dustypomerleau/README.md create mode 100644 keyboards/minidox/keymaps/dustypomerleau/config.h create mode 100644 keyboards/minidox/keymaps/dustypomerleau/keymap.c create mode 100644 keyboards/minidox/keymaps/dustypomerleau/rules.mk diff --git a/keyboards/minidox/keymaps/dustypomerleau/README.md b/keyboards/minidox/keymaps/dustypomerleau/README.md new file mode 100644 index 000000000..b2ec77125 --- /dev/null +++ b/keyboards/minidox/keymaps/dustypomerleau/README.md @@ -0,0 +1,28 @@ +## dustypomerleau, Minidox layout + +The rationale behind my layout can be summarized as follows: + +- Symmetry is important because use-cases are hard to predict. Whenever possible, modifiers and layer keys should be available from either hand. +- Inward rolls should be leveraged not just for alphas (Colemak DHm), but also for coding/symbols. +- Number order—like alpha order—should be designed to favor use of the strongest fingers. +- One-shot keys can greatly reduce the strain of typing, and should be leveraged. + +Some aspects of my layout are optimized for macOS (order of modifiers, manner of producing en and em dashes, coding of micro-volume adjustments, etc.), but can be easily tweaked for the OS of your choice. + +Shift can be a tricky modifier when used in `MT()` combinations, particularly for fast typists on split boards using serial. This can be partially mitigated with options in `config.h`, but still requires a relatively strict typing style/accuracy from the fast typist. The tendency is for faster typists to combat mod/tap mistakes by using very short intervals for `TAPPING_TERM`, but this can introduce its own set of complications. Shift is also one of the highest-yield opportunities to use `OSM()`. For these reasons, I pulled Shift onto dedicated keys in the thumbs for use during regular typing (the home row Shifts have been left in place for use during selection and keycuts). + +The tapdance code that I used to create mod/tap keys inside my symbol layer allows up to 2 consecutive symbols within `TAPPING_TERM`. If you think you will need to quickly nest more than that, feel free to add more `case`s. + +### Special thanks + +- Everyone on the QMK Discord, for helping me work out the code for mod/tap keys using shifted symbols. +- Everyone on the Colemak Discord, for their initial feedback on the layout. +- @stevep and @DreymaR, for their work on Colemak DH(m), a truly awesome typing experience (and of course Shai Coleman, for starting it all off!). +- @ckofy, for offering a dramatic improvement on Dvorak's original number order. +- u/That-Canadian, for designing this awesome keyboard. + +### Questions or comments? + +- GitHub @dustypomerleau +- Twitter @duspom +- Discord @dusty#8897 diff --git a/keyboards/minidox/keymaps/dustypomerleau/config.h b/keyboards/minidox/keymaps/dustypomerleau/config.h new file mode 100644 index 000000000..5166e06d8 --- /dev/null +++ b/keyboards/minidox/keymaps/dustypomerleau/config.h @@ -0,0 +1,26 @@ +// dustypomerleau, Minidox config + +#pragma once + + +#define EE_HANDS +#define IGNORE_MOD_TAP_INTERRUPT +#define ONESHOT_TIMEOUT 1000 +#define TAPPING_TERM 200 +#define USE_SERIAL + +// optional configuration: + +// #define CONVERT_TO_PROTON_C +// #define ONESHOT_TAP_TOGGLE 2 // not compatible with TAPPING_FORCE_HOLD +// #define PERMISSIVE_HOLD +// #define TAPPING_FORCE_HOLD // allows rapid mod use after tap event, but sacrifices double-tap to repeat + +// #define MOUSEKEY_DELAY 0 // delay before cursor movement (high feels sluggish, low makes fine movement difficult) +// #define MOUSEKEY_INTERVAL 20 // time between movement reports - low settings feel like high mouse speed +// #define MOUSEKEY_MAX_SPEED 10 +// #define MOUSEKEY_TIME_TO_MAX 60 +// #define MOUSEKEY_WHEEL_DELAY 0 +// #define MOUSEKEY_WHEEL_MAX_SPEED 8 +// #define MOUSEKEY_WHEEL_TIME_TO_MAX 4 + diff --git a/keyboards/minidox/keymaps/dustypomerleau/keymap.c b/keyboards/minidox/keymaps/dustypomerleau/keymap.c new file mode 100644 index 000000000..13b84d64d --- /dev/null +++ b/keyboards/minidox/keymaps/dustypomerleau/keymap.c @@ -0,0 +1,489 @@ +// Minidox keymap by dustypomerleau +// Thanks for checking out my keymap. The rationale behind the layout is described in the README. + +#include QMK_KEYBOARD_H + +extern keymap_config_t keymap_config; + +enum custom_layers { + _CMK_DHM, + _QWERTY, + _SYS, + _NAV, + _NUM_E, + _NUM_N, + _SYM +}; + +enum custom_keycodes { + CMK_DHM = SAFE_RANGE, + QWERTY, + SYS, + NAV, + NUM_E, + NUM_N, + SYM +}; + +typedef struct { + bool is_press_action; + int state; +} tap; + +enum { + SINGLE_TAP = 1, + SINGLE_HOLD = 2, + DOUBLE_SINGLE_TAP = 3 +}; + +enum { + ALT_OP = 0, + CTL_CCB, + GUI_CP, + SFT_OCB, + SFT_PLS +}; + +int cur_dance (qk_tap_dance_state_t *state); +void altop_finished (qk_tap_dance_state_t *state, void *user_data); +void altop_reset (qk_tap_dance_state_t *state, void *user_data); +void ctlccb_finished (qk_tap_dance_state_t *state, void *user_data); +void ctlccb_reset (qk_tap_dance_state_t *state, void *user_data); +void guicp_finished (qk_tap_dance_state_t *state, void *user_data); +void guicp_reset (qk_tap_dance_state_t *state, void *user_data); +void sftocb_finished (qk_tap_dance_state_t *state, void *user_data); +void sftocb_reset (qk_tap_dance_state_t *state, void *user_data); +void sftpls_finished (qk_tap_dance_state_t *state, void *user_data); +void sftpls_reset (qk_tap_dance_state_t *state, void *user_data); + +#define _______ KC_TRNS +#define ALT_2 LALT_T(KC_2) +#define ALT_3 LALT_T(KC_3) +#define ALT_8 LALT_T(KC_8) +#define ALT_D LALT_T(KC_D) +#define ALT_E LALT_T(KC_E) +#define ALT_K LALT_T(KC_K) +#define ALT_OB LALT_T(KC_LBRC) +#define ALT_S LALT_T(KC_S) +#define CTRL_2 LCTL_T(KC_2) +#define CTRL_4 LCTL_T(KC_4) +#define CTRL_5 LCTL_T(KC_5) +#define CTRL_9 LCTL_T(KC_9) +#define CTRL_EQ LCTL_T(KC_EQL) +#define CTRL_I LCTL_T(KC_I) +#define CTRL_L LCTL_T(KC_L) +#define CTRL_R LCTL_T(KC_R) +#define CTRL_S LCTL_T(KC_S) +#define GUI_0 LGUI_T(KC_0) +#define GUI_1 LGUI_T(KC_1) +#define GUI_4 LGUI_T(KC_4) +#define GUI_7 LGUI_T(KC_7) +#define GUI_CB LGUI_T(KC_RBRC) +#define GUI_F LGUI_T(KC_F) +#define GUI_J LGUI_T(KC_J) +#define GUI_N LGUI_T(KC_N) +#define GUI_TEA LGUI_T(KC_T) +#define MAC_EM S(LALT(KC_MINS)) +#define MAC_EN LALT(KC_MINS) +#define NAV_BK LT(_NAV, KC_BSPC) +#define NAV_LK TG(_NAV) +#define NUME_SPC LT(_NUM_E, KC_SPC) +#define NUMLK_E TG(_NUM_E) +#define NUMLK_N TG(_NUM_N) +#define NUMN_SPC LT(_NUM_N, KC_SPC) +#define SFT_0 LSFT_T(KC_0) +#define SFT_1 LSFT_T(KC_1) +#define SFT_6 LSFT_T(KC_6) +#define SFT_7 LSFT_T(KC_7) +#define SFT_A LSFT_T(KC_A) +#define SFT_O LSFT_T(KC_O) +#define SFT_OS OSM(MOD_LSFT) +#define SFT_QOT LSFT_T(KC_QUOT) +#define SYM_OS OSL(_SYM) +#define SYS_Z LT(_SYS, KC_Z) +#define VOL_DN S(LALT(KC__VOLDOWN)) +#define VOL_UP S(LALT(KC__VOLUP)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Colemak DHm + * + * ,----------------------------------. ,----------------------------------. + * | Q | W | F | P | B | | J | L | U | Y | ' | + * |------+------+------+------+------| |------+------+------+------+------| + * | SFT/A| CTL/R| ALT/S| GUI/T| G | | M | GUI/N| ALT/E| CTL/I| SFT/O| + * |------+------+------+------+------| |------+------+------+------+------| + * | SYS/Z| X | C | D | V | | K | H | , | . | ; | + * `----------------------------------' `----------------------------------' + * ,--------------------. ,--------------------. + * |SFT/OS|NAV/BK| | | |NUM/SP|SFT/OS| + * `------+------|SYM/OS| |SYM/OS|------+------' + * | | | | + * `------' `------' + */ +[_CMK_DHM] = LAYOUT( \ + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, \ + SFT_A, CTRL_R, ALT_S, GUI_TEA, KC_G, KC_M, GUI_N, ALT_E, CTRL_I, SFT_O, \ + SYS_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SCLN, \ + SFT_OS, NAV_BK, SYM_OS, SYM_OS, NUME_SPC, SFT_OS \ +), + +/* QWERTY + * + * ,----------------------------------. ,----------------------------------. + * | Q | W | E | R | T | | Y | U | I | O | P | + * |------+------+------+------+------| |------+------+------+------+------| + * | SFT/A| CTL/S| ALT/D| GUI/F| G | | H | GUI/J| ALT/K| CTL/L| SFT/'| + * |------+------+------+------+------| |------+------+------+------+------| + * | SYS/Z| X | C | V | B | | N | M | , | . | ; | + * `----------------------------------' `----------------------------------' + * ,--------------------. ,--------------------. + * |SFT/OS|NAV/BK| | | |NUM/SP|SFT/OS| + * `------+------|SYM/OS| |SYM/OS|------+------' + * | | | | + * `------' `------' + */ +[_QWERTY] = LAYOUT( \ + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ + SFT_A, CTRL_S, ALT_D, GUI_F, KC_G, KC_H, GUI_J, ALT_K, CTRL_L, SFT_QOT, \ + SYS_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SCLN, \ + SFT_OS, NAV_BK, SYM_OS, SYM_OS, NUMN_SPC, SFT_OS \ +), + +/* System, media, and layer lock keys + * If you use QWERTY + the Vanilla numbers primarily, change NUMLK_E to NUMLK_N here. + * + * ,----------------------------------. ,----------------------------------. + * | RESET|DEBUG |QWERTY|CMKDHM| | | | VOL--| VOL++| | | + * |------+------+------+------+------| |------+------+------+------+------| + * | SHIFT| CTRL | ALT | GUI |NAV LK| | POWER| VOL- | VOL+ | MUTE | MPLY | + * |------+------+------+------+------| |------+------+------+------+------| + * | | |AU OFF| AU ON| | | |NUM LK| MRWD | MFFD | | + * `----------------------------------' `----------------------------------' + * ,--------------------. ,------,-------------. + * | | | | | | | | + * `-------------| | | |------+------. + * | | | | + * `------' `------' + */ +[_SYS] = LAYOUT( \ + RESET, DEBUG, QWERTY, CMK_DHM, _______, _______, KC__VOLDOWN, KC__VOLUP, _______, _______, \ + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, NAV_LK, KC_POWER, VOL_DN, VOL_UP, KC__MUTE, KC_MPLY, \ + _______, _______, AU_OFF, AU_ON, _______, _______, NUMLK_E, KC_MRWD, KC_MFFD, _______, \ + _______, _______, _______, _______, _______, _______ \ +), + +/* Navigation + mouse keys + * + * ,----------------------------------. ,----------------------------------. + * | PSCR | | WH U | WH D | | | BSPC | PGDN | PGUP | HOME | END | + * |------+------+------+------+------| |------+------+------+------+------| + * | SHIFT| CTRL | ALT | GUI |NAV LK| | CAPS | LEFT | DOWN | UP | RIGHT| + * |------+------+------+------+------| |------+------+------+------+------| + * | | ACL0 | ACL1 | ACL2 | BTN2 | | BTN1 | MS L | MS D | MS U | MS R | + * `----------------------------------' `----------------------------------' + * ,--------------------. ,--------------------. + * | | | | | | ENTER| | + * `------+------| ESC | | DEL |------+------' + * | | | | + * `------' `------' + */ +[_NAV] = LAYOUT( \ + KC_PSCR, _______, KC_WH_U, KC_WH_D, _______, KC_BSPC, KC_PGDN, KC_PGUP, KC_HOME, KC_END, \ + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, NAV_LK, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, \ + _______, KC_ACL0, KC_ACL1, KC_ACL2, KC_BTN2, KC_BTN1, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, \ + _______, _______, KC_ESC, KC_DEL, KC_ENT, _______ \ +), + +/* Number + function keys (ergonomic number order - default pairing with Colemak) + * + * ,----------------------------------. ,----------------------------------. + * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | + * |------+------+------+------+------| |------+------+------+------+------| + * | SFT/7| CTL/5| ALT/3| GUI/1| 9 | | 8 | GUI/0| ALT/2| CTL/4| SFT/6| + * |------+------+------+------+------| |------+------+------+------+------| + * | | | F11 | F12 | BSPC | | DEL |NUM LK| | | | + * `----------------------------------' `----------------------------------' + * ,--------------------. ,--------------------. + * | | TAB | | | | | | + * `------+------| ESC | | |------+------' + * | | | | + * `------' `------' + */ +[_NUM_E] = LAYOUT( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \ + SFT_7, CTRL_5, ALT_3, GUI_1, KC_9, KC_8, GUI_0, ALT_2, CTRL_4, SFT_6, \ + _______, _______, KC_F11, KC_F12, KC_BSPC, KC_DEL, NUMLK_E, _______, _______, _______, \ + _______, KC_TAB, KC_ESC, _______, _______, _______ \ +), + +/* Number + function keys (numeric number order - default pairing with QWERTY) + * + * ,----------------------------------. ,----------------------------------. + * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | + * |------+------+------+------+------| |------+------+------+------+------| + * | SFT/1| CTL/2| ALT/3| GUI/4| 5 | | 6 | GUI/7| ALT/8| CTL/9| SFT/0| + * |------+------+------+------+------| |------+------+------+------+------| + * | | | F11 | F12 | BSPC | | DEL |NUM LK| | | | + * `----------------------------------' `----------------------------------' + * ,--------------------. ,--------------------. + * | | TAB | | | | | | + * `------+------| ESC | | |------+------' + * | | | | + * `------' `------' + */ +[_NUM_N] = LAYOUT( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \ + SFT_1, CTRL_2, ALT_3, GUI_4, KC_5, KC_6, GUI_7, ALT_8, CTRL_9, SFT_0, \ + _______, _______, KC_F11, KC_F12, KC_BSPC, KC_DEL, NUMLK_N, _______, _______, _______, \ + _______, KC_TAB, KC_ESC, _______, _______, _______ \ +), + + +/* Symbols + * + * ,----------------------------------. ,----------------------------------. + * | ! | @ | # | $ | % | | ^ | & | * | ? | ' | + * |------+------+------+------+------| |------+------+------+------+------| + * | SFT/+| CTL/=| ALT/(| GUI/)| " | | : | GUI/]| ALT/[| CTL/}| SFT/{| + * |------+------+------+------+------| |------+------+------+------+------| + * | < | | | - | > | \ | | ` | _ | / | ~ | ; | + * `----------------------------------' `----------------------------------' + * ,--------------------. ,--------------------. + * | |ENDASH| | | |EMDASH| | + * `------+------| | | |------+------' + * | | | | + * `------' `------' + */ +[_SYM] = LAYOUT( \ + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_QUES, KC_QUOT, \ + TD(SFT_PLS), CTRL_EQ, TD(ALT_OP), TD(GUI_CP), KC_DQT, KC_COLN, GUI_CB, ALT_OB, TD(CTL_CCB), TD(SFT_OCB), \ + KC_LT, KC_PIPE, KC_MINS, KC_GT, KC_BSLS, KC_GRV, KC_UNDS, KC_SLSH, KC_TILD, KC_SCLN, \ + _______, MAC_EN, _______, _______, MAC_EM, _______ \ +) + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case CMK_DHM: + if (record->event.pressed) { + set_single_persistent_default_layer(_CMK_DHM); + } + return false; + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + default: + return true; + } +}; + +int cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } + if (state->count == 2) return DOUBLE_SINGLE_TAP; + else return 8; +} + +static tap altop_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void altop_finished (qk_tap_dance_state_t *state, void *user_data) { + altop_tap_state.state = cur_dance(state); + switch (altop_tap_state.state) { + case SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + register_code(KC_9); + break; + case SINGLE_HOLD: + register_mods(MOD_BIT(KC_LALT)); + break; + case DOUBLE_SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + tap_code(KC_9); + register_code(KC_9); + } +} + +void altop_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (altop_tap_state.state) { + case SINGLE_TAP: + unregister_code(KC_9); + unregister_mods(MOD_BIT(KC_LSFT)); + break; + case SINGLE_HOLD: + unregister_mods(MOD_BIT(KC_LALT)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_9); + unregister_mods(MOD_BIT(KC_LSFT)); + } + altop_tap_state.state = 0; +} + +static tap ctlccb_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void ctlccb_finished (qk_tap_dance_state_t *state, void *user_data) { + ctlccb_tap_state.state = cur_dance(state); + switch (ctlccb_tap_state.state) { + case SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + register_code(KC_RBRC); + break; + case SINGLE_HOLD: + register_mods(MOD_BIT(KC_LCTL)); + break; + case DOUBLE_SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + tap_code(KC_RBRC); + register_code(KC_RBRC); + } +} + +void ctlccb_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (ctlccb_tap_state.state) { + case SINGLE_TAP: + unregister_code(KC_RBRC); + unregister_mods(MOD_BIT(KC_LSFT)); + break; + case SINGLE_HOLD: + unregister_mods(MOD_BIT(KC_LCTL)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_RBRC); + unregister_mods(MOD_BIT(KC_LSFT)); + } + ctlccb_tap_state.state = 0; +} + +static tap guicp_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void guicp_finished (qk_tap_dance_state_t *state, void *user_data) { + guicp_tap_state.state = cur_dance(state); + switch (guicp_tap_state.state) { + case SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + register_code(KC_0); + break; + case SINGLE_HOLD: + register_mods(MOD_BIT(KC_LGUI)); + break; + case DOUBLE_SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + tap_code(KC_0); + register_code(KC_0); + } +} + +void guicp_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (guicp_tap_state.state) { + case SINGLE_TAP: + unregister_code(KC_0); + unregister_mods(MOD_BIT(KC_LSFT)); + break; + case SINGLE_HOLD: + unregister_mods(MOD_BIT(KC_LGUI)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_0); + unregister_mods(MOD_BIT(KC_LSFT)); + } + guicp_tap_state.state = 0; +} + +static tap sftocb_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void sftocb_finished (qk_tap_dance_state_t *state, void *user_data) { + sftocb_tap_state.state = cur_dance(state); + switch (sftocb_tap_state.state) { + case SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + register_code(KC_LBRC); + break; + case SINGLE_HOLD: + register_mods(MOD_BIT(KC_LSFT)); + break; + case DOUBLE_SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + tap_code(KC_LBRC); + register_code(KC_LBRC); + } +} + +void sftocb_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (sftocb_tap_state.state) { + case SINGLE_TAP: + unregister_code(KC_LBRC); + unregister_mods(MOD_BIT(KC_LSFT)); + break; + case SINGLE_HOLD: + unregister_mods(MOD_BIT(KC_LSFT)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_LBRC); + unregister_mods(MOD_BIT(KC_LSFT)); + } + sftocb_tap_state.state = 0; +} + +static tap sftpls_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void sftpls_finished (qk_tap_dance_state_t *state, void *user_data) { + sftpls_tap_state.state = cur_dance(state); + switch (sftpls_tap_state.state) { + case SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + register_code(KC_EQL); + break; + case SINGLE_HOLD: + register_mods(MOD_BIT(KC_LSFT)); + break; + case DOUBLE_SINGLE_TAP: + register_mods(MOD_BIT(KC_LSFT)); + tap_code(KC_EQL); + register_code(KC_EQL); + } +} + +void sftpls_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (sftpls_tap_state.state) { + case SINGLE_TAP: + unregister_code(KC_EQL); + unregister_mods(MOD_BIT(KC_LSFT)); + break; + case SINGLE_HOLD: + unregister_mods(MOD_BIT(KC_LSFT)); + break; + case DOUBLE_SINGLE_TAP: + unregister_code(KC_EQL); + unregister_mods(MOD_BIT(KC_LSFT)); + } + sftpls_tap_state.state = 0; +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [ALT_OP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altop_finished, altop_reset), + [CTL_CCB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctlccb_finished, ctlccb_reset), + [GUI_CP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, guicp_finished, guicp_reset), + [SFT_OCB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sftocb_finished, sftocb_reset), + [SFT_PLS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sftpls_finished, sftpls_reset) +}; diff --git a/keyboards/minidox/keymaps/dustypomerleau/rules.mk b/keyboards/minidox/keymaps/dustypomerleau/rules.mk new file mode 100644 index 000000000..5ed4c5446 --- /dev/null +++ b/keyboards/minidox/keymaps/dustypomerleau/rules.mk @@ -0,0 +1,4 @@ +# dustypomerleau, Minidox rules + +MOUSEKEY_ENABLE = yes +TAP_DANCE_ENABLE = yes