diff options
| author | Reed <rmwphd@gmail.com> | 2020-06-29 13:23:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-29 10:23:13 -0700 |
| commit | 1baa99c6473473ba3204c9861951e70c10d037cb (patch) | |
| tree | 2f53db277340f411a690bef3127768007720062e /users/rmw | |
| parent | e9e6054ee7eaca4cbd8d1c7566f394559ea8770a (diff) | |
| download | qmk_firmware-1baa99c6473473ba3204c9861951e70c10d037cb.tar.gz qmk_firmware-1baa99c6473473ba3204c9861951e70c10d037cb.zip | |
[Keymap] Adding my keymaps for ergodox_ez and kyria (#9365)
* Trying to fix problems in my kyria steez
* repeating last commit.....
* repeating last commit on EDIT layer but swapping direction
exit
* moving the reversed desktop moves to the symbol layers on the same hand, for easier activation
* adding mac desktop movement keys to Kyria layout
* Adding readmes to my keymaps
* Removing a png...
* Update keyboards/ergodox_ez/keymaps/rmw/keymap-mac.c removing EPRM case
* Apply suggestions from code review
Great updates to various old-school or outdated ways I was doing things, removing some commented out code, etc.
* Apply suggestions from code review
Additional improvements
* Moving tapdances.cpp to userspace as tapdances.c
* reindenting the Kyria keymap to follow four-spaces convention, turning off oled on my kyria, improving the led handling on the Ergodox.
* updating led stuff on the other two versions of the keymap, removing EPRM key from main keymap
* Apply suggestions from code review
I'm adding these various removals to the config file because it seems that at this time those settings are in harmony with the ergodox_ez defaults.
* Moving encoder functions into their own userspace file
* Apply suggestions from code review
Removing settings that are now defaults, clearing out placeholder custom keycodes (smh)
* updating encoder functions.
* Moving to LAYOUT_stack for all layers, adding end of file newlines, switching to some shorter keycode aliases
* Okay, refactor is well underway.
* refactored! Also improved led handling for ergodox and rgb handling for kyria
* removing mac/windows swappable version because I don't feel like dealing with it when reflashing is so easy.
* moving LAYOUT_stack into kyria.h
* moving the alternate default layer down next to QWERTY
Diffstat (limited to 'users/rmw')
| -rw-r--r-- | users/rmw/encoder_functions.c | 53 | ||||
| -rw-r--r-- | users/rmw/encoder_functions.h | 11 | ||||
| -rw-r--r-- | users/rmw/rmw.c | 1 | ||||
| -rw-r--r-- | users/rmw/rmw.h | 87 | ||||
| -rw-r--r-- | users/rmw/rules.mk | 9 | ||||
| -rw-r--r-- | users/rmw/tapdances.c | 389 | ||||
| -rw-r--r-- | users/rmw/tapdances.h | 46 |
7 files changed, 596 insertions, 0 deletions
diff --git a/users/rmw/encoder_functions.c b/users/rmw/encoder_functions.c new file mode 100644 index 000000000..39032d0eb --- /dev/null +++ b/users/rmw/encoder_functions.c | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | // Encoder functions to mix and match! | ||
| 2 | |||
| 3 | #include "encoder_functions.h" | ||
| 4 | |||
| 5 | void enc_move_words(bool cw){ // Move whole words. Hold shift to select while moving. | ||
| 6 | if (cw) { | ||
| 7 | tap_code16(A(KC_RGHT)); | ||
| 8 | } else { | ||
| 9 | tap_code16(A(KC_LEFT)); | ||
| 10 | } | ||
| 11 | } | ||
| 12 | void enc_history_scrubbing(bool cw){ // Undo/Redo. | ||
| 13 | if (cw) { | ||
| 14 | tap_code16(G(S(KC_Z))); | ||
| 15 | } else { | ||
| 16 | tap_code16(G(KC_Z)); | ||
| 17 | } | ||
| 18 | } | ||
| 19 | void enc_scrolling(bool cw){ // Scrolling. | ||
| 20 | if (cw) { | ||
| 21 | tap_code(KC_MS_WH_DOWN); | ||
| 22 | } else { | ||
| 23 | tap_code(KC_MS_WH_UP); | ||
| 24 | } | ||
| 25 | } | ||
| 26 | void enc_scrolling_h(bool cw){ // Scrolling. | ||
| 27 | if (cw) { | ||
| 28 | tap_code(KC_MS_WH_RIGHT); | ||
| 29 | } else { | ||
| 30 | tap_code(KC_MS_WH_LEFT); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | void enc_volume_knob(bool cw){ // Volume control. | ||
| 34 | if (cw) { | ||
| 35 | tap_code(KC_VOLU); | ||
| 36 | } else { | ||
| 37 | tap_code(KC_VOLD); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | void enc_move_desktop(bool cw){ // Switch Desktops (Mac). | ||
| 41 | if (cw) { | ||
| 42 | tap_code16(C(KC_RIGHT)); | ||
| 43 | } else { | ||
| 44 | tap_code16(C(KC_LEFT)); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | void enc_zoom(bool cw){ // Zoom in/zoom out. | ||
| 48 | if (cw) { | ||
| 49 | tap_code16(G(KC_PLUS)); | ||
| 50 | } else { | ||
| 51 | tap_code16(G(KC_MINUS)); | ||
| 52 | } | ||
| 53 | } | ||
diff --git a/users/rmw/encoder_functions.h b/users/rmw/encoder_functions.h new file mode 100644 index 000000000..d80a78668 --- /dev/null +++ b/users/rmw/encoder_functions.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #pragma once | ||
| 2 | #include QMK_KEYBOARD_H | ||
| 3 | #include "rmw.h" | ||
| 4 | |||
| 5 | void enc_move_words(bool cw); | ||
| 6 | void enc_history_scrubbing(bool cw); | ||
| 7 | void enc_scrolling(bool cw); | ||
| 8 | void enc_scrolling_h(bool cw); | ||
| 9 | void enc_volume_knob(bool cw); | ||
| 10 | void enc_move_desktop(bool cw); | ||
| 11 | void enc_zoom(bool cw); | ||
diff --git a/users/rmw/rmw.c b/users/rmw/rmw.c new file mode 100644 index 000000000..bb1c1984f --- /dev/null +++ b/users/rmw/rmw.c | |||
| @@ -0,0 +1 @@ | |||
| #include "rmw.h" | |||
diff --git a/users/rmw/rmw.h b/users/rmw/rmw.h new file mode 100644 index 000000000..272a400c7 --- /dev/null +++ b/users/rmw/rmw.h | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | #pragma once | ||
| 2 | #include QMK_KEYBOARD_H | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | #include "action.h" | ||
| 6 | #include "version.h" | ||
| 7 | |||
| 8 | #ifdef TAP_DANCE_ENABLE | ||
| 9 | #include "tapdances.h" | ||
| 10 | #endif | ||
| 11 | |||
| 12 | #ifdef ENCODER_ENABLE | ||
| 13 | #include "encoder_functions.h" | ||
| 14 | #endif | ||
| 15 | |||
| 16 | enum user_layers { | ||
| 17 | QWERTY = 0 | ||
| 18 | ,MINIMAK4 | ||
| 19 | ,NUMPAD | ||
| 20 | ,EDIT | ||
| 21 | ,FSYM | ||
| 22 | ,JSYM | ||
| 23 | ,MEDIA | ||
| 24 | ,ADJUST | ||
| 25 | }; | ||
| 26 | |||
| 27 | |||
| 28 | // Custom keycodes | ||
| 29 | #define SFTENT SFT_T(KC_ENT) | ||
| 30 | |||
| 31 | enum user_custom_keycodes_universal { | ||
| 32 | VRSN = SAFE_RANGE | ||
| 33 | ,OS_CSFT = OSM(MOD_LSFT | MOD_LCTL) | ||
| 34 | ,OS_GSFT = OSM(MOD_LSFT | MOD_LGUI) | ||
| 35 | ,OS_CALT = OSM(MOD_LCTL | MOD_LALT) | ||
| 36 | ,OS_ALT = OSM(MOD_LALT) | ||
| 37 | ,OS_CTL = OSM(MOD_LCTL) | ||
| 38 | ,NEW_SAFE_RANGE | ||
| 39 | }; | ||
| 40 | |||
| 41 | #ifdef MACOSX | ||
| 42 | enum user_custom_keycodes { | ||
| 43 | FORM_GET = NEW_SAFE_RANGE | ||
| 44 | ,FORM_PUT | ||
| 45 | ,OS_CMD = OSM(MOD_LGUI) | ||
| 46 | ,R_UNDO = LGUI(KC_Z) | ||
| 47 | ,R_REDO = LGUI(KC_Y) | ||
| 48 | ,R_CUT = LGUI(KC_X) | ||
| 49 | ,R_COPY = LGUI(KC_C) | ||
| 50 | ,R_PASTE = LGUI(KC_V) | ||
| 51 | ,DEL_WRD = LALT(KC_BSPACE) | ||
| 52 | ,MVW_LEFT = LALT(KC_LEFT) | ||
| 53 | ,MVW_RIGHT = LALT(KC_RIGHT) | ||
| 54 | ,SELW_LEFT = LALT(S(KC_LEFT)) | ||
| 55 | ,SELW_RIGHT = LALT(S(KC_RIGHT)) | ||
| 56 | ,NEW_TAB = LGUI(KC_T) | ||
| 57 | ,TASK_MAN = LGUI(LALT(KC_ESCAPE)) | ||
| 58 | ,SEL_HOME = S(LGUI(KC_LEFT)) | ||
| 59 | ,SEL_END = S(LGUI(KC_RIGHT)) | ||
| 60 | ,R_HOME = LGUI(KC_LEFT) | ||
| 61 | ,R_END = LGUI(KC_RIGHT) | ||
| 62 | }; | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #ifdef WINDOWS | ||
| 66 | enum user_custom_keycodes { | ||
| 67 | FORM_GET = NEW_SAFE_RANGE | ||
| 68 | ,FORM_PUT | ||
| 69 | ,OS_WIN = OSM(MOD_LGUI) | ||
| 70 | ,R_UNDO = LCTL(KC_Z) | ||
| 71 | ,R_REDO = LCTL(KC_Y) | ||
| 72 | ,R_CUT = LCTL(KC_X) | ||
| 73 | ,R_COPY = LCTL(KC_C) | ||
| 74 | ,R_PASTE = LCTL(KC_V) | ||
| 75 | ,DEL_WRD = LALT(KC_BSPACE) | ||
| 76 | ,MVW_LEFT = LCTL(KC_LEFT) | ||
| 77 | ,MVW_RIGHT = LCTL(KC_RIGHT) | ||
| 78 | ,SELW_LEFT = LCTL(S(KC_LEFT)) | ||
| 79 | ,SELW_RIGHT = LCTL(S(KC_RIGHT)) | ||
| 80 | ,NEW_TAB = LCTL(KC_T) | ||
| 81 | ,TASK_MAN = LCTL(LALT(KC_ESCAPE)) | ||
| 82 | ,SEL_HOME = S(KC_HOME) | ||
| 83 | ,SEL_END = S(KC_END) | ||
| 84 | ,R_HOME = KC_HOME | ||
| 85 | ,R_END = KC_END | ||
| 86 | }; | ||
| 87 | #endif | ||
diff --git a/users/rmw/rules.mk b/users/rmw/rules.mk new file mode 100644 index 000000000..468745dbc --- /dev/null +++ b/users/rmw/rules.mk | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | SRC += rmw.c | ||
| 2 | |||
| 3 | ifdef TAP_DANCE_ENABLE | ||
| 4 | SRC += tapdances.c | ||
| 5 | endif | ||
| 6 | |||
| 7 | ifdef ENCODER_ENABLE | ||
| 8 | SRC += encoder_functions.c | ||
| 9 | endif | ||
diff --git a/users/rmw/tapdances.c b/users/rmw/tapdances.c new file mode 100644 index 000000000..1b44a8725 --- /dev/null +++ b/users/rmw/tapdances.c | |||
| @@ -0,0 +1,389 @@ | |||
| 1 | // Useful tapdance functions! | ||
| 2 | |||
| 3 | #include "tapdances.h" | ||
| 4 | |||
| 5 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 6 | [SHCAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, caps, shift_reset) | ||
| 7 | ,[TDGUI] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftgui, gui_reset) | ||
| 8 | ,[TDGUI2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, guictl, ubermod_reset) | ||
| 9 | ,[SHENT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftenter, shift_reset) | ||
| 10 | ,[SHNTC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftentercaps, shift_reset) | ||
| 11 | ,[GCA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod_mac, ubermod_reset) // GUI->CTL->ALT | ||
| 12 | ,[AGC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod2_mac, ubermod_reset) // ALT->GUI->CTL | ||
| 13 | ,[SGCA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shift_and_mac, CASG_reset) // SG->SC->SA | ||
| 14 | ,[GUCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, guictl, ubermod_reset) | ||
| 15 | ,[CAG] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod, ubermod_reset) // CTL->ALT->GUI | ||
| 16 | ,[ACG] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod2, ubermod_reset) // ALT->GUI->CTL | ||
| 17 | ,[SCAG] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shift_and, CASG_reset) // SG->SC->SA | ||
| 18 | ,[DLTR] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, deleter, ubermod_reset) // backspace, backspace, alt backspace, gui backspace | ||
| 19 | ,[FRBK2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, forward_back_mac, ubermod_reset) | ||
| 20 | ,[CTLALL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctrl_all_mac, ubermod_reset) // C->CG->CA->CAG | ||
| 21 | ,[CTLAND] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctrl_all, ubermod_reset) // C->CA->CG->CAG | ||
| 22 | ,[FRBK] = ACTION_TAP_DANCE_DOUBLE(KC_WWW_BACK,KC_WWW_FORWARD) | ||
| 23 | }; | ||
| 24 | |||
| 25 | void caps(qk_tap_dance_state_t *state, void *user_data) // Shift, Caps | ||
| 26 | { if (state->count >= 2) {register_code(KC_CAPS); unregister_code(KC_CAPS);} | ||
| 27 | else if (state->pressed) {register_mods(MOD_LSFT);} else {set_oneshot_mods(MOD_LSFT);} | ||
| 28 | reset_tap_dance(state); | ||
| 29 | } | ||
| 30 | |||
| 31 | void forward_back_mac(qk_tap_dance_state_t *state, void *user_data) // G<-, then G-> | ||
| 32 | { | ||
| 33 | if (state->count > 1) { | ||
| 34 | tap_code16(G(KC_RGHT)); | ||
| 35 | } | ||
| 36 | else { | ||
| 37 | tap_code16(G(KC_LEFT)); | ||
| 38 | } | ||
| 39 | reset_tap_dance(state); | ||
| 40 | } | ||
| 41 | |||
| 42 | void shiftgui(qk_tap_dance_state_t *state, void *user_data) // G->SG | ||
| 43 | { | ||
| 44 | if (state->count > 1) { | ||
| 45 | if (state->pressed) { | ||
| 46 | register_mods(MOD_LSFT | MOD_LGUI); | ||
| 47 | } | ||
| 48 | else { | ||
| 49 | set_oneshot_mods(MOD_LSFT | MOD_LGUI); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | else if (state->pressed) { | ||
| 53 | register_mods(MOD_LGUI); | ||
| 54 | } | ||
| 55 | else { | ||
| 56 | set_oneshot_mods(MOD_LGUI); | ||
| 57 | } | ||
| 58 | reset_tap_dance(state); | ||
| 59 | } | ||
| 60 | |||
| 61 | void guictl(qk_tap_dance_state_t *state, void *user_data) // G->GC | ||
| 62 | { | ||
| 63 | if (state->count > 1) { | ||
| 64 | if (state->pressed) { | ||
| 65 | register_mods(MOD_LCTL | MOD_LGUI); | ||
| 66 | } | ||
| 67 | else { | ||
| 68 | set_oneshot_mods(MOD_LCTL | MOD_LGUI); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | else if (state->pressed) { | ||
| 72 | register_mods(MOD_LGUI); | ||
| 73 | } | ||
| 74 | else { | ||
| 75 | set_oneshot_mods(MOD_LGUI); | ||
| 76 | } | ||
| 77 | reset_tap_dance(state); | ||
| 78 | } | ||
| 79 | |||
| 80 | void deleter(qk_tap_dance_state_t *state, void *user_data) // bkspc -> delwrd -> delline | ||
| 81 | { | ||
| 82 | if (state->count > 3) { | ||
| 83 | tap_code16(G(KC_BSPC)); | ||
| 84 | } | ||
| 85 | else if (state->count > 2) { | ||
| 86 | tap_code16(A(KC_BSPC)); | ||
| 87 | } | ||
| 88 | else { | ||
| 89 | tap_code(KC_BSPC); | ||
| 90 | } | ||
| 91 | reset_tap_dance(state); | ||
| 92 | } | ||
| 93 | |||
| 94 | void ubermod(qk_tap_dance_state_t *state, void *user_data) // CTL->ALT->GUI | ||
| 95 | { | ||
| 96 | if (state->count > 2) { | ||
| 97 | if (state->pressed) { | ||
| 98 | register_mods(MOD_LGUI); | ||
| 99 | } | ||
| 100 | else { | ||
| 101 | set_oneshot_mods(MOD_LGUI); | ||
| 102 | } | ||
| 103 | } | ||
| 104 | else if (state->count > 1) { | ||
| 105 | if (state->pressed) { | ||
| 106 | register_mods(MOD_LALT); | ||
| 107 | } | ||
| 108 | else { | ||
| 109 | set_oneshot_mods(MOD_LALT); | ||
| 110 | } | ||
| 111 | } | ||
| 112 | else if (state->pressed) { | ||
| 113 | register_mods(MOD_LCTL); | ||
| 114 | } | ||
| 115 | else { | ||
| 116 | set_oneshot_mods(MOD_LCTL); | ||
| 117 | } | ||
| 118 | reset_tap_dance(state); | ||
| 119 | } | ||
| 120 | |||
| 121 | void ubermod_mac(qk_tap_dance_state_t *state, void *user_data) // GUI->CTL->ALT | ||
| 122 | { | ||
| 123 | if (state->count > 2) { | ||
| 124 | if (state->pressed) { | ||
| 125 | register_mods(MOD_LALT); | ||
| 126 | } | ||
| 127 | else { | ||
| 128 | set_oneshot_mods(MOD_LALT); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | else if (state->count > 1) { | ||
| 132 | if (state->pressed) { | ||
| 133 | register_mods(MOD_LCTL); | ||
| 134 | } | ||
| 135 | else { | ||
| 136 | set_oneshot_mods(MOD_LCTL); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | else if (state->pressed) { | ||
| 140 | register_mods(MOD_LGUI); | ||
| 141 | } | ||
| 142 | else { | ||
| 143 | set_oneshot_mods(MOD_LGUI); | ||
| 144 | } | ||
| 145 | reset_tap_dance(state); | ||
| 146 | } | ||
| 147 | |||
| 148 | void ubermod2(qk_tap_dance_state_t *state, void *user_data) // ALT->CTL->GUI | ||
| 149 | { | ||
| 150 | if (state->count > 2) { | ||
| 151 | if (state->pressed) { | ||
| 152 | register_mods(MOD_LGUI); | ||
| 153 | } | ||
| 154 | else { | ||
| 155 | set_oneshot_mods(MOD_LGUI); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | else if (state->count > 1) { | ||
| 159 | if (state->pressed) { | ||
| 160 | register_mods(MOD_LCTL); | ||
| 161 | } | ||
| 162 | else { | ||
| 163 | set_oneshot_mods(MOD_LCTL); | ||
| 164 | } | ||
| 165 | } | ||
| 166 | else if (state->pressed) { | ||
| 167 | register_mods(MOD_LALT); | ||
| 168 | } | ||
| 169 | else { | ||
| 170 | set_oneshot_mods(MOD_LALT); | ||
| 171 | } | ||
| 172 | reset_tap_dance(state); | ||
| 173 | } | ||
| 174 | |||
| 175 | void ubermod2_mac(qk_tap_dance_state_t *state, void *user_data) // ALT->GUI->CTL | ||
| 176 | { | ||
| 177 | if (state->count > 2) { | ||
| 178 | if (state->pressed) { | ||
| 179 | register_mods(MOD_LCTL); | ||
| 180 | } | ||
| 181 | else { | ||
| 182 | set_oneshot_mods(MOD_LCTL); | ||
| 183 | } | ||
| 184 | } | ||
| 185 | else if (state->count > 1) { | ||
| 186 | if (state->pressed) { | ||
| 187 | register_mods(MOD_LGUI); | ||
| 188 | } | ||
| 189 | else { | ||
| 190 | set_oneshot_mods(MOD_LGUI); | ||
| 191 | } | ||
| 192 | } | ||
| 193 | else if (state->pressed) { | ||
| 194 | register_mods(MOD_LALT); | ||
| 195 | } | ||
| 196 | else { | ||
| 197 | set_oneshot_mods(MOD_LALT); | ||
| 198 | } | ||
| 199 | reset_tap_dance(state); | ||
| 200 | } | ||
| 201 | |||
| 202 | void shift_reset(qk_tap_dance_state_t *state, void *user_data) | ||
| 203 | { | ||
| 204 | unregister_mods(MOD_LSFT); | ||
| 205 | // clear_oneshot_mods(); | ||
| 206 | } | ||
| 207 | void gui_reset(qk_tap_dance_state_t *state, void *user_data) | ||
| 208 | { | ||
| 209 | unregister_mods(MOD_LSFT | MOD_LGUI); | ||
| 210 | } | ||
| 211 | void CAS_reset(qk_tap_dance_state_t *state, void *user_data) | ||
| 212 | { | ||
| 213 | unregister_mods(MOD_LCTL | MOD_LSFT | MOD_LALT); | ||
| 214 | } | ||
| 215 | void CASG_reset(qk_tap_dance_state_t *state, void *user_data) | ||
| 216 | { | ||
| 217 | unregister_mods(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI); | ||
| 218 | // clear_oneshot_mods(); | ||
| 219 | } | ||
| 220 | void ubermod_reset(qk_tap_dance_state_t *state, void *user_data) // AKA CAG_reset | ||
| 221 | { | ||
| 222 | unregister_mods(MOD_LCTL | MOD_LALT | MOD_LGUI); | ||
| 223 | } | ||
| 224 | |||
| 225 | void shiftenter(qk_tap_dance_state_t *state, void *user_data) | ||
| 226 | { | ||
| 227 | if (state->count > 1) { | ||
| 228 | tap_code(KC_ENT); | ||
| 229 | } | ||
| 230 | else if (state->pressed) { | ||
| 231 | register_mods(MOD_LSFT); | ||
| 232 | } | ||
| 233 | else { | ||
| 234 | set_oneshot_mods(MOD_LSFT); | ||
| 235 | } | ||
| 236 | reset_tap_dance(state); | ||
| 237 | } | ||
| 238 | |||
| 239 | void shiftentercaps(qk_tap_dance_state_t *state, void *user_data) | ||
| 240 | { | ||
| 241 | if (state->count > 2) { | ||
| 242 | tap_code(KC_CAPS); | ||
| 243 | } | ||
| 244 | else if (state->count > 1) { | ||
| 245 | tap_code(KC_ENT); | ||
| 246 | } | ||
| 247 | else if (state->pressed) { | ||
| 248 | register_mods(MOD_LSFT); | ||
| 249 | } | ||
| 250 | else { | ||
| 251 | set_oneshot_mods(MOD_LSFT); | ||
| 252 | } | ||
| 253 | reset_tap_dance(state); | ||
| 254 | } | ||
| 255 | |||
| 256 | void ctrl_all_mac(qk_tap_dance_state_t *state, void *user_data) // C->CG->CAG | ||
| 257 | { | ||
| 258 | if (state->count > 2) { | ||
| 259 | if (state->pressed) { | ||
| 260 | register_mods(MOD_LCTL | MOD_LALT | MOD_LGUI); | ||
| 261 | } | ||
| 262 | else { | ||
| 263 | set_oneshot_mods(MOD_LCTL | MOD_LGUI | MOD_LALT); | ||
| 264 | } | ||
| 265 | } | ||
| 266 | else if (state->count > 1) { | ||
| 267 | if (state->pressed) { | ||
| 268 | register_mods(MOD_LCTL | MOD_LGUI); | ||
| 269 | } | ||
| 270 | else { | ||
| 271 | set_oneshot_mods(MOD_LCTL | MOD_LGUI); | ||
| 272 | } | ||
| 273 | } | ||
| 274 | else if (state->pressed) { | ||
| 275 | register_mods(MOD_LCTL); | ||
| 276 | } | ||
| 277 | else { | ||
| 278 | set_oneshot_mods(MOD_LCTL); | ||
| 279 | } | ||
| 280 | reset_tap_dance(state); | ||
| 281 | } | ||
| 282 | |||
| 283 | void ctrl_all(qk_tap_dance_state_t *state, void *user_data) // C->CA->SC | ||
| 284 | { | ||
| 285 | if (state->count > 2) { | ||
| 286 | if (state->pressed) { | ||
| 287 | register_mods(MOD_LCTL | MOD_LSFT); | ||
| 288 | } | ||
| 289 | else { | ||
| 290 | set_oneshot_mods(MOD_LCTL | MOD_LSFT); | ||
| 291 | } | ||
| 292 | } | ||
| 293 | else if (state->count > 1) { | ||
| 294 | if (state->pressed) { | ||
| 295 | register_mods(MOD_LCTL | MOD_LALT); | ||
| 296 | } | ||
| 297 | else { | ||
| 298 | set_oneshot_mods(MOD_LCTL | MOD_LALT); | ||
| 299 | } | ||
| 300 | } | ||
| 301 | else if (state->pressed) { | ||
| 302 | register_mods(MOD_LCTL); | ||
| 303 | } | ||
| 304 | else { | ||
| 305 | set_oneshot_mods(MOD_LCTL); | ||
| 306 | } | ||
| 307 | reset_tap_dance(state); | ||
| 308 | } | ||
| 309 | |||
| 310 | void alt_all(qk_tap_dance_state_t *state, void *user_data) // A->SA->AC | ||
| 311 | { | ||
| 312 | if (state->count > 2) { | ||
| 313 | if (state->pressed) { | ||
| 314 | register_mods(MOD_LCTL | MOD_LALT); | ||
| 315 | } | ||
| 316 | else { | ||
| 317 | set_oneshot_mods(MOD_LALT | MOD_LCTL); | ||
| 318 | } | ||
| 319 | } | ||
| 320 | else if (state->count > 1) { | ||
| 321 | if (state->pressed) { | ||
| 322 | register_mods(MOD_LSFT | MOD_LALT); | ||
| 323 | } | ||
| 324 | else { | ||
| 325 | set_oneshot_mods(MOD_LALT | MOD_LSFT); | ||
| 326 | } | ||
| 327 | } | ||
| 328 | else if (state->pressed) { | ||
| 329 | register_mods(MOD_LALT); | ||
| 330 | } | ||
| 331 | else { | ||
| 332 | set_oneshot_mods(MOD_LALT); | ||
| 333 | } | ||
| 334 | reset_tap_dance(state); | ||
| 335 | } | ||
| 336 | |||
| 337 | void shift_and(qk_tap_dance_state_t *state, void *user_data) // SC->SA->SG | ||
| 338 | { | ||
| 339 | if (state->count > 2) { | ||
| 340 | if (state->pressed) { | ||
| 341 | register_mods(MOD_LSFT | MOD_LGUI); | ||
| 342 | } | ||
| 343 | else { | ||
| 344 | set_oneshot_mods(MOD_LGUI | MOD_LSFT); | ||
| 345 | } | ||
| 346 | } | ||
| 347 | else if (state->count > 1) { | ||
| 348 | if (state->pressed) { | ||
| 349 | register_mods(MOD_LSFT | MOD_LALT); | ||
| 350 | } | ||
| 351 | else { | ||
| 352 | set_oneshot_mods(MOD_LALT | MOD_LSFT); | ||
| 353 | } | ||
| 354 | } | ||
| 355 | else if (state->pressed) { | ||
| 356 | register_mods(MOD_LCTL | MOD_LSFT); | ||
| 357 | } | ||
| 358 | else { | ||
| 359 | set_oneshot_mods(MOD_LSFT | MOD_LCTL); | ||
| 360 | } | ||
| 361 | reset_tap_dance(state); | ||
| 362 | } | ||
| 363 | |||
| 364 | void shift_and_mac(qk_tap_dance_state_t *state, void *user_data) // SG->SC->SA | ||
| 365 | { | ||
| 366 | if (state->count > 1) { | ||
| 367 | if (state->pressed) { | ||
| 368 | register_mods(MOD_LSFT | MOD_LALT); | ||
| 369 | } | ||
| 370 | else { | ||
| 371 | set_oneshot_mods(MOD_LALT | MOD_LSFT); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | else if (state->count > 2) { | ||
| 375 | if (state->pressed) { | ||
| 376 | register_mods(MOD_LCTL | MOD_LSFT); | ||
| 377 | } | ||
| 378 | else { | ||
| 379 | set_oneshot_mods(MOD_LSFT | MOD_LCTL); | ||
| 380 | } | ||
| 381 | } | ||
| 382 | else if (state->pressed) { | ||
| 383 | register_mods(MOD_LSFT | MOD_LGUI); | ||
| 384 | } | ||
| 385 | else { | ||
| 386 | set_oneshot_mods(MOD_LGUI | MOD_LSFT); | ||
| 387 | } | ||
| 388 | reset_tap_dance(state); | ||
| 389 | } | ||
diff --git a/users/rmw/tapdances.h b/users/rmw/tapdances.h new file mode 100644 index 000000000..11425011c --- /dev/null +++ b/users/rmw/tapdances.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #pragma once | ||
| 2 | #include "rmw.h" | ||
| 3 | #include "process_tap_dance.h" | ||
| 4 | #include "action.h" | ||
| 5 | |||
| 6 | void caps(qk_tap_dance_state_t *state, void *user_data); // Shift, Caps | ||
| 7 | void forward_back_mac(qk_tap_dance_state_t *state, void *user_data); // G<-, then G-> | ||
| 8 | void shiftgui(qk_tap_dance_state_t *state, void *user_data); // G->SG | ||
| 9 | void guictl(qk_tap_dance_state_t *state, void *user_data); // G->GC | ||
| 10 | void deleter(qk_tap_dance_state_t *state, void *user_data); // bkspc -> delwrd -> delline | ||
| 11 | void ubermod(qk_tap_dance_state_t *state, void *user_data); // CTL->ALT->GUI | ||
| 12 | void ubermod_mac(qk_tap_dance_state_t *state, void *user_data); // GUI->CTL->ALT | ||
| 13 | void ubermod2(qk_tap_dance_state_t *state, void *user_data); // ALT->CTL->GUI | ||
| 14 | void ubermod2_mac(qk_tap_dance_state_t *state, void *user_data); // ALT->GUI->CTL | ||
| 15 | void shift_reset(qk_tap_dance_state_t *state, void *user_data); | ||
| 16 | void gui_reset(qk_tap_dance_state_t *state, void *user_data); | ||
| 17 | void CAS_reset(qk_tap_dance_state_t *state, void *user_data); | ||
| 18 | void CASG_reset(qk_tap_dance_state_t *state, void *user_data); | ||
| 19 | void ubermod_reset(qk_tap_dance_state_t *state, void *user_data); // AKA CAG_reset | ||
| 20 | void shiftenter(qk_tap_dance_state_t *state, void *user_data); | ||
| 21 | void shiftentercaps(qk_tap_dance_state_t *state, void *user_data); | ||
| 22 | void ctrl_all_mac(qk_tap_dance_state_t *state, void *user_data); // C->CG->CAG | ||
| 23 | void ctrl_all(qk_tap_dance_state_t *state, void *user_data); // C->CA->SC | ||
| 24 | void alt_all(qk_tap_dance_state_t *state, void *user_data); // A->SA->AC | ||
| 25 | void shift_and(qk_tap_dance_state_t *state, void *user_data); // SC->SA->SG | ||
| 26 | void shift_and_mac(qk_tap_dance_state_t *state, void *user_data); // SG->SC->SA | ||
| 27 | |||
| 28 | enum { | ||
| 29 | SHCAP = 0 | ||
| 30 | ,TDGUI | ||
| 31 | ,TDGUI2 | ||
| 32 | ,SHENT | ||
| 33 | ,SHNTC | ||
| 34 | ,GUCTL | ||
| 35 | ,FRBK | ||
| 36 | ,FRBK2 | ||
| 37 | ,GCA | ||
| 38 | ,AGC | ||
| 39 | ,SGCA | ||
| 40 | ,SCAG | ||
| 41 | ,CAG | ||
| 42 | ,ACG | ||
| 43 | ,CTLALL | ||
| 44 | ,CTLAND | ||
| 45 | ,DLTR | ||
| 46 | }; | ||
