keymap.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #include "lets_split.h"
  2. #include "action_layer.h"
  3. #include "action_util.h"
  4. #include "debug.h"
  5. #include "eeconfig.h"
  6. extern keymap_config_t keymap_config;
  7. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  8. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  9. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  10. // entirely and just use numbers.
  11. #define _COLE 0
  12. #define _LOWER 1
  13. #define _RAISE 2
  14. #define _AUX 16
  15. /* Layers */
  16. enum
  17. {
  18. COLE = 0,
  19. LOWER, // right hand 10 key.
  20. RAISE, // left hand Fn, right hand symbols.
  21. AUX,
  22. };
  23. /* Tap Dancery */
  24. enum
  25. {
  26. TD_BTK,
  27. TD_TDE,
  28. TD_LPRN,
  29. TD_RPRN,
  30. TD_MIN,
  31. TD_USC,
  32. };
  33. bool time_travel = false;
  34. // Fillers to make layering more clear
  35. #define ____ KC_TRNS
  36. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  37. /* Colemak
  38. * ,-----------------------------------------------------------------------------------.
  39. * | ' " `| Q | W | F | P | G | J | L | U | Y | = + | ~ ; :|
  40. * |------+------+------+------+------+-------------+------+------+------+------+------|
  41. * | ( [ {| A | R | S | T | D | H | N | E | I | O | ) ] }|
  42. * |------+------+------+------+------+------|------+------+------+------+------+------|
  43. * | - , <| Z | X | C | V | B | K | M | ? | | | ^ | _ . >|
  44. * |------+------+------+------+------+------+------+------+------+------+------+------|
  45. * |Lower |Raise | Ctrl | Alt | Bksp | Spc |Enter |LShft | ESC | < | v | > |
  46. * `-----------------------------------------------------------------------------------'
  47. */
  48. [_COLE] = LAYOUT(
  49. TD(TD_BTK), KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_EQL, TD(TD_TDE),
  50. TD(TD_LPRN), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, TD(TD_RPRN),
  51. TD(TD_MIN), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_SLSH, KC_BSLS, KC_UP, TD(TD_USC),
  52. LOWER, RAISE, OSM(MOD_LCTL), OSM(MOD_LALT), KC_SPC, KC_BSPC, KC_ENT, OSM(MOD_LSFT), KC_ESC, KC_LEFT, KC_DOWN, KC_RGHT),
  53. /* Lower
  54. * ,-----------------------------------------------------------------------------------.
  55. * | ---- | ---- | ---- | ---- | ---- | ---- | 7 | 8 | 9 | * | / | ^ |
  56. * |------+------+------+------+------+-------------+------+------+------+------+------|
  57. * | ---- | ---- | ---- | ---- | ---- | ---- | 4 | 5 | 6 | + | - | ---- |
  58. * |------+------+------+------+------+------|------+------+------+------+------+------|
  59. * | ---- | ---- | ---- | ---- | ---- | ---- | 1 | 2 | 3 | = | ---- | ---- |
  60. * |------+------+------+------+------+------+------+------+------+------+------+------|
  61. * | ---- | ---- | ---- | ---- | ---- | ---- | ---- | 0 | . | ---- | ---- | ---- |
  62. * `-----------------------------------------------------------------------------------'
  63. */
  64. [_LOWER] = LAYOUT(
  65. ____, ____, ____, ____, ____, ____, KC_7, KC_8, KC_9, KC_PAST, KC_PSLS, KC_CIRC,
  66. ____, ____, ____, ____, ____, ____, KC_4, KC_5, KC_6, KC_PPLS, KC_PMNS, ____,
  67. ____, ____, ____, ____, ____, ____, KC_1, KC_2, KC_3, KC_PEQL, ____, ____,
  68. ____, ____, ____, ____, ____, ____, ____, KC_0, KC_MNXT, ____, ____, ____),
  69. /* Raise
  70. * ,-----------------------------------------------------------------------------------.
  71. * | F1 | F2 | F3 | F4 | F5 | F6 | ! | @ | # | $ | % | ` ~ |
  72. * |------+------+------+------+------+-------------+------+------+------+------+------|
  73. * | F7 | F8 | F9 | F10 | F11 | F12 | ^ | & | * | ( | ) | - _ |
  74. * |------+------+------+------+------+------|------+------+------+------+------+------|
  75. * | ____ | ____ | ____ | ____ | ____ | ____ | [ { | ] } | \ | | ; : | ' " | = + |
  76. * |------+------+------+------+------+------+------+------+------+------+------+------|
  77. * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | , < | . > | / ? |
  78. * `-----------------------------------------------------------------------------------'
  79. */
  80. [_RAISE] = LAYOUT(
  81. KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_GRV,
  82. KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_MINS,
  83. KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LBRC, KC_RBRC, KC_BSLS, KC_SCLN, KC_QUOT, KC_EQL,
  84. ____, ____, ____, ____, ____, ____, ____, ____, ____, KC_COMM, KC_DOT, KC_SLSH),
  85. /* Adjust (Lower + Raise)
  86. * ,-----------------------------------------------------------------------------------.
  87. * | Reset| ____ | ____ | ____ | ____ | ____ | ____ | LOCK | ____ | ____ | ____ | VUP |
  88. * |------+------+------+------+------+-------------+------+------+------+------+------|
  89. * | ____ | ____ | RUN | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | VDWN |
  90. * |------+------+------+------+------+------|------+------+------+------+------+------|
  91. * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | PGUP | MUTE |
  92. * |------+------+------+------+------+------+------+------+------+------+------+------|
  93. * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | HOME | PGDN | END |
  94. * `-----------------------------------------------------------------------------------'
  95. */
  96. [_AUX] = LAYOUT(
  97. RESET, ____, ____, ____, ____, ____, ____, LGUI(KC_L), ____, ____, ____, KC_VOLU,
  98. ____, ____, LGUI(KC_R), ____, ____, ____, ____, ____, ____, ____, ____, KC_VOLD,
  99. ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, KC_PGUP, KC_MUTE,
  100. ____, ____, ____, ____, KC_TAB, KC_DEL, ____, ____, ____, KC_HOME, KC_PGDOWN, KC_END)
  101. };
  102. qk_tap_dance_action_t tap_dance_actions[] = {
  103. [TD_BTK] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_GRV),
  104. [TD_TDE] = ACTION_TAP_DANCE_DOUBLE(KC_SCLN, KC_TILD),
  105. [TD_LPRN] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, KC_LPRN),
  106. [TD_RPRN] = ACTION_TAP_DANCE_DOUBLE(KC_RBRC, KC_RPRN),
  107. [TD_MIN] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_MINS),
  108. [TD_USC] = ACTION_TAP_DANCE_DOUBLE(KC_DOT, KC_UNDS)};
  109. void persistent_default_layer_set(uint16_t default_layer)
  110. {
  111. eeconfig_update_default_layer(default_layer);
  112. default_layer_set(default_layer);
  113. };
  114. void matrix_scan_user(void){};
  115. void matrix_init_user(void){};
  116. bool process_record_user(uint16_t keycode, keyrecord_t *record)
  117. {
  118. switch (keycode)
  119. {
  120. case COLE:
  121. if (record->event.pressed)
  122. {
  123. persistent_default_layer_set(1UL << _COLE);
  124. }
  125. return false;
  126. break;
  127. case LOWER:
  128. if (record->event.pressed)
  129. {
  130. layer_on(_LOWER);
  131. update_tri_layer(_LOWER, _RAISE, _AUX);
  132. }
  133. else
  134. {
  135. layer_off(_LOWER);
  136. update_tri_layer(_LOWER, _RAISE, _AUX);
  137. }
  138. return false;
  139. break;
  140. case RAISE:
  141. if (record->event.pressed)
  142. {
  143. layer_on(_RAISE);
  144. update_tri_layer(_LOWER, _RAISE, _AUX);
  145. }
  146. else
  147. {
  148. layer_off(_RAISE);
  149. update_tri_layer(_LOWER, _RAISE, _AUX);
  150. }
  151. return false;
  152. break;
  153. case AUX:
  154. if (record->event.pressed)
  155. {
  156. layer_on(_AUX);
  157. }
  158. else
  159. {
  160. layer_off(_AUX);
  161. }
  162. return false;
  163. break;
  164. }
  165. return true;
  166. }