keymap.c 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. Copyright 2019 @foostan
  3. Copyright 2020 Drashna Jaelre <@drashna>
  4. Copyright 2021 Tyler Thrailkill <@snowe/@snowe2010>
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include QMK_KEYBOARD_H
  17. #include "snowe.h"
  18. // Symbols chart
  19. // ↯ hyper key (ctrl, alt, shift, super)
  20. // ⌘ command
  21. // ⌥ option
  22. // ⌃ control
  23. // ⇧ shift
  24. // ⌫ backspace
  25. // ⌦ delete
  26. // ⎋ escape
  27. // ↩ enter
  28. /* Wrapper
  29. * ,-----------------------------------------------. .-----------------------------------------------.
  30. * | Tab | K01 | K02 | K03 | K04 | K05 | | K06 | K07 | K08 | K09 | K0A | |
  31. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  32. * | ⌘/⎋ | ⌃/K11 | K12 | K13 | K14 | K15 | | K16 | K17 | K18 | K19 | ⌥/K1A | |
  33. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  34. * | ↯/⌦ | ⌥/K21 | K22 | K23 | K24 | K25 | | K26 | K27 | K28 | K29 | ⌃/K2A | |
  35. * `-----------------------. | | .-----------------------'
  36. * |-------+-------+-------| |-------+-------+-------|
  37. * | ⌃ | ⇧/↩ | ⌫/LWR | | ␣/RAY | ␣ | R ⌥ |
  38. * `-----------------------' '-----------------------'
  39. */
  40. // clang-format off
  41. #define LAYOUT_crkbd_base( \
  42. K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
  43. K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
  44. K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
  45. ) \
  46. LAYOUT_wrapper( \
  47. KC_TAB, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
  48. GUI_ESC, CTL_T(K11), K12, K13, K14, K15, K16, K17, K18, K19, ALT_T(K1A), KC_QUOT, \
  49. HYPR_T(KC_DEL), ALT_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), KC_BSLS, \
  50. KC_LCTL, LOWER, SH_BKSP, KC_ENTER, SP_RAIS, KC_LALT \
  51. )
  52. // clang-format on
  53. #define LAYOUT_crkbd_base_wrapper(...) LAYOUT_crkbd_base(__VA_ARGS__)
  54. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  55. // clang-format off
  56. /* QWERTY
  57. * ,-----------------------------------------------. .-----------------------------------------------.
  58. * | | Q | W | E | R | T | | Y | U | I | O | P | |
  59. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  60. * | | A | S | D | F | G | | H | J | K | L | ; | ' |
  61. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  62. * | | Z | X | C | V | B | | N | M | , | . | / | |
  63. * `-----------------------. | | .-----------------------'
  64. * |-------+-------+-------| |-------+-------+-------|
  65. * | | | | | | | |
  66. * `-----------------------' '-----------------------'
  67. */
  68. [_MAIN] = LAYOUT_crkbd_base_wrapper(
  69. _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
  70. _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
  71. _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
  72. ),
  73. /* Lower
  74. * ,-----------------------------------------------. .-----------------------------------------------.
  75. * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
  76. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  77. * | | | | | | | | | _ | + | [ | ] | |
  78. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  79. * | | | | | | | | | ← | ↑ | ↓ | → | |
  80. * `-----------------------. | | .-----------------------'
  81. * |-------+-------+-------| |-------+-------+-------|
  82. * | | | | | | | |
  83. * `-----------------------' '-----------------------'
  84. */
  85. [_LOWER] = LAYOUT_wrapper(
  86. KC_TILDE, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11,
  87. KC_F12 , _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
  88. _______ , _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
  89. _______, _______, _______, _______, _______, _______
  90. ),
  91. /*
  92. * ,-----------------------------------------------. .-----------------------------------------------.
  93. * | | | | | | | | | | | | | |
  94. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  95. * | | | | | | | | | | | | | |
  96. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  97. * | | | | | | | | | | | | | |
  98. * `-----------------------. | | .-----------------------'
  99. * |-------+-------+-------| |-------+-------+-------|
  100. * | | | | | | | |
  101. * `-----------------------' '-----------------------'
  102. */
  103. /* Raise
  104. * ,-----------------------------------------------. .-----------------------------------------------.
  105. * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
  106. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  107. * | | | | | | | | | ← | ↑ | ↓ | → | |
  108. * |-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
  109. * | | | | | | | | | home |pg down| pg up | end | |
  110. * `-----------------------. | | .-----------------------'
  111. * |-------+-------+-------| |-------+-------+-------|
  112. * | | | | | | | |
  113. * `-----------------------' '-----------------------'
  114. */
  115. [_UPPER] = LAYOUT_wrapper( \
  116. KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______,
  117. _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
  118. _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
  119. _______, _______, _______, _______, _______, _______
  120. ),
  121. [_ADJUST] = LAYOUT_wrapper( \
  122. _______, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET,
  123. _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST,
  124. _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
  125. _______, _______, _______, _______, _______, _______
  126. )
  127. // clang-format on
  128. };
  129. layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _UPPER, _ADJUST); }
  130. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  131. switch (keycode) {
  132. case KC_LCTL:
  133. case KC_RCTL:
  134. #ifdef OCEAN_DREAM_ENABLE
  135. is_calm = (record->event.pressed) ? true : false;
  136. #endif
  137. #ifdef LUNA_ENABLE
  138. if (record->event.pressed) {
  139. isSneaking = true;
  140. } else {
  141. isSneaking = false;
  142. }
  143. #endif
  144. break;
  145. case KC_SPC:
  146. #ifdef LUNA_ENABLE
  147. if (record->event.pressed) {
  148. isJumping = true;
  149. showedJump = false;
  150. } else {
  151. isJumping = false;
  152. }
  153. #endif
  154. break;
  155. }
  156. return true;
  157. }
  158. // uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
  159. // switch (keycode) {
  160. // case ALT_T(KC_A):
  161. // case SH_BKSP:
  162. // return TAPPING_TERM + 500;
  163. // default:
  164. // return TAPPING_TERM;
  165. // }
  166. //}
  167. //
  168. // bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
  169. // switch (keycode) {
  170. // case ALT_T(KC_A):
  171. // case SH_BKSP:
  172. // return true;
  173. // default:
  174. // return false;
  175. // }
  176. //}