keymap.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /* Copyright 2021 Danny Nguyen <danny@keeb.io>
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>.
  12. */
  13. #include QMK_KEYBOARD_H
  14. enum layer_names {
  15. _MAC,
  16. _WINDOWS,
  17. _TESTMODE,
  18. _LOWER,
  19. _RAISE,
  20. _FKEYS,
  21. _ADJUST,
  22. };
  23. enum custom_keycodes {
  24. MAC = SAFE_RANGE,
  25. WINDOWS,
  26. TESTMODE,
  27. LOWER,
  28. RAISE,
  29. ADJUST,
  30. };
  31. #define KC_ KC_TRNS
  32. #define KC_CAPW LGUI(LSFT(KC_3)) // Capture whole screen
  33. #define KC_CPYW LGUI(LSFT(LCTL(KC_3))) // Copy whole screen
  34. #define KC_CAPP LGUI(LSFT(KC_4)) // Capture portion of screen
  35. #define KC_CPYP LGUI(LSFT(LCTL(KC_4))) // Copy portion of screen
  36. #define KC_ESCC MT(MOD_LCTL, KC_ESC)
  37. #define KC_LOWR LOWER
  38. #define KC_RASE RAISE
  39. #define KC_GRVF LT(_FKEYS, KC_GRV)
  40. #define KC_ENTS MT(MOD_LSFT, KC_ENT)
  41. #define KC_BL_S BL_STEP
  42. #define KC_BL_T BL_TOGG
  43. #define KC_RMOD RGB_MOD
  44. #ifndef LAYOUT_kc_ortho_4x12
  45. #define LAYOUT_kc_ortho_4x12( \
  46. L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
  47. L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
  48. L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
  49. L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
  50. ) \
  51. LAYOUT_ortho_4x12( \
  52. KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
  53. KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
  54. KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
  55. KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \
  56. )
  57. #endif
  58. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  59. [_MAC] = LAYOUT_kc_ortho_4x12(
  60. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  61. TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
  62. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  63. ESCC, A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
  64. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  65. LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENTS,
  66. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  67. GRVF,LCTL,LALT,LGUI,LOWR,SPC , BSPC,RASE,LEFT,DOWN, UP ,RGHT
  68. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  69. ),
  70. [_WINDOWS] = LAYOUT_kc_ortho_4x12(
  71. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  72. TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
  73. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  74. ESCC, A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
  75. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  76. LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENTS,
  77. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  78. GRVF,LALT,LGUI,LCTL,LOWR,SPC , BSPC,RASE,LEFT,DOWN, UP ,RGHT
  79. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  80. ),
  81. [_TESTMODE] = LAYOUT_kc_ortho_4x12(
  82. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  83. TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
  84. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  85. RMOD,BL_S, S , D , F , G , RMOD,BL_S, K , L ,SCLN,QUOT,
  86. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  87. LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENTS,
  88. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  89. GRVF,LALT,LGUI,LCTL,LOWR,SPC , BSPC,RASE,LEFT,DOWN, UP ,RGHT
  90. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  91. ),
  92. [_LOWER] = LAYOUT_kc_ortho_4x12(
  93. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  94. , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , ,
  95. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  96. DEL ,CAPP,LEFT,RGHT, UP ,LBRC, RBRC, P4 , P5 , P6 ,PLUS,PIPE,
  97. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  98. ,CPYP, , ,DOWN,LCBR, RCBR, P1 , P2 , P3 ,MINS, ,
  99. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  100. BL_S,BL_T, , , ,DEL , DEL , , P0 ,PDOT, ,
  101. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  102. ),
  103. [_RAISE] = LAYOUT_kc_ortho_4x12(
  104. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  105. ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN, ,
  106. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  107. DEL ,MPRV,MNXT,VOLU,PGUP,UNDS, EQL ,HOME, , , ,BSLS,
  108. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  109. MUTE,MSTP,MPLY,VOLD,PGDN,MINS, PLUS,END , , , , ,
  110. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  111. , , , , , , , , , , ,
  112. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  113. ),
  114. [_FKEYS] = LAYOUT_kc_ortho_4x12(
  115. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  116. F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,
  117. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  118. , , , , , , , , , , , ,
  119. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  120. , , , , , , , , , , , ,
  121. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  122. , , , , , , , , , , ,
  123. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  124. ),
  125. /* Adjust (Lower + Raise)
  126. * ,-----------------------------------------------------------------------------------.
  127. * | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn|Sat Up|Sat Dn|Val Up|Val Dn| | |
  128. * |------+------+------+------+------+-------------+------+------+------+------+------|
  129. * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
  130. * |------+------+------+------+------+------|------+------+------+------+------+------|
  131. * | | | | | | | | | | | | |
  132. * |------+------+------+------+------+------+------+------+------+------+------+------|
  133. * | | | | | | | | | | | |
  134. * `-----------------------------------------------------------------------------------'
  135. */
  136. [_ADJUST] = LAYOUT_ortho_4x12(
  137. _______, QK_BOOT, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, _______,
  138. _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, MAC, WINDOWS, TESTMODE,_______, _______,
  139. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  140. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  141. )
  142. };
  143. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  144. switch (keycode) {
  145. case MAC:
  146. if (record->event.pressed) {
  147. set_single_persistent_default_layer(_MAC);
  148. }
  149. return false;
  150. break;
  151. case WINDOWS:
  152. if (record->event.pressed) {
  153. set_single_persistent_default_layer(_WINDOWS);
  154. }
  155. return false;
  156. break;
  157. case TESTMODE:
  158. if (record->event.pressed) {
  159. set_single_persistent_default_layer(_TESTMODE);
  160. }
  161. return false;
  162. break;
  163. case LOWER:
  164. if (record->event.pressed) {
  165. layer_on(_LOWER);
  166. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  167. } else {
  168. layer_off(_LOWER);
  169. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  170. }
  171. return false;
  172. break;
  173. case RAISE:
  174. if (record->event.pressed) {
  175. layer_on(_RAISE);
  176. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  177. } else {
  178. layer_off(_RAISE);
  179. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  180. }
  181. return false;
  182. break;
  183. case ADJUST:
  184. if (record->event.pressed) {
  185. layer_on(_ADJUST);
  186. } else {
  187. layer_off(_ADJUST);
  188. }
  189. return false;
  190. break;
  191. }
  192. return true;
  193. }