keymap.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #include QMK_KEYBOARD_H
  2. extern keymap_config_t keymap_config;
  3. #define _MAC 0
  4. #define _WINDOWS 1
  5. #define _TESTMODE 2
  6. #define _LOWER 3
  7. #define _RAISE 4
  8. #define _FKEYS 5
  9. #define _ADJUST 16
  10. enum custom_keycodes {
  11. MAC = SAFE_RANGE,
  12. WINDOWS,
  13. TESTMODE,
  14. LOWER,
  15. RAISE,
  16. ADJUST,
  17. PLAY_ALLSTAR,
  18. };
  19. #define KC_ KC_TRNS
  20. #define _______ KC_TRNS
  21. #define KC_CAPW LGUI(LSFT(KC_3)) // Capture whole screen
  22. #define KC_CPYW LGUI(LSFT(LCTL(KC_3))) // Copy whole screen
  23. #define KC_CAPP LGUI(LSFT(KC_4)) // Capture portion of screen
  24. #define KC_CPYP LGUI(LSFT(LCTL(KC_4))) // Copy portion of screen
  25. #define KC_ESCC MT(MOD_LCTL, KC_ESC)
  26. #define KC_LOWR LOWER
  27. #define KC_RASE RAISE
  28. #define KC_GRVF LT(_FKEYS, KC_GRV)
  29. #define KC_ENTS MT(MOD_LSFT, KC_ENT)
  30. #define KC_BL_S BL_STEP
  31. #define KC_BL_T BL_TOGG
  32. #define KC_RMOD RGB_MOD
  33. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  34. [_MAC] = LAYOUT_kc_ortho_4x12(
  35. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  36. TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
  37. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  38. ESCC, A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
  39. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  40. LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENTS,
  41. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  42. GRVF,LCTL,LALT,LGUI,LOWR,SPC , BSPC,RASE,LEFT,DOWN, UP ,RGHT
  43. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  44. ),
  45. [_WINDOWS] = LAYOUT_kc_ortho_4x12(
  46. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  47. TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
  48. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  49. ESCC, A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
  50. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  51. LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENTS,
  52. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  53. GRVF,LALT,LGUI,LCTL,LOWR,SPC , BSPC,RASE,LEFT,DOWN, UP ,RGHT
  54. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  55. ),
  56. [_TESTMODE] = LAYOUT_kc_ortho_4x12(
  57. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  58. TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
  59. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  60. RMOD,BL_S, S , D , F , G , RMOD,BL_S, K , L ,SCLN,QUOT,
  61. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  62. LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENTS,
  63. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  64. GRVF,LALT,LGUI,LCTL,LOWR,SPC , BSPC,RASE,LEFT,DOWN, UP ,RGHT
  65. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  66. ),
  67. [_LOWER] = LAYOUT_kc_ortho_4x12(
  68. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  69. , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , ,
  70. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  71. DEL ,CAPP,LEFT,RGHT, UP ,LBRC, RBRC, P4 , P5 , P6 ,PLUS,PIPE,
  72. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  73. ,CPYP, , ,DOWN,LCBR, RCBR, P1 , P2 , P3 ,MINS, ,
  74. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  75. BL_S,BL_T, , , ,DEL , DEL , , P0 ,PDOT, ,
  76. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  77. ),
  78. [_RAISE] = LAYOUT_kc_ortho_4x12(
  79. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  80. ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN, ,
  81. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  82. DEL ,MPRV,MNXT,VOLU,PGUP,UNDS, EQL ,HOME, , , ,BSLS,
  83. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  84. MUTE,MSTP,MPLY,VOLD,PGDN,MINS, PLUS,END , , , , ,
  85. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  86. , , , , , , , , , , ,
  87. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  88. ),
  89. [_FKEYS] = LAYOUT_kc_ortho_4x12(
  90. //┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐
  91. F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,
  92. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  93. , , , , , , , , , , , ,
  94. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  95. , , , , , , , , , , , ,
  96. //├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤
  97. , , , , , , , , , , ,
  98. //└────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘
  99. ),
  100. /* Adjust (Lower + Raise)
  101. * ,-----------------------------------------------------------------------------------.
  102. * | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn|Sat Up|Sat Dn|Val Up|Val Dn| | |
  103. * |------+------+------+------+------+-------------+------+------+------+------+------|
  104. * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
  105. * |------+------+------+------+------+------|------+------+------+------+------+------|
  106. * | | | | | | | | | | | | |
  107. * |------+------+------+------+------+------+------+------+------+------+------+------|
  108. * | | | | | | | | | | | |
  109. * `-----------------------------------------------------------------------------------'
  110. */
  111. [_ADJUST] = LAYOUT_ortho_4x12( \
  112. _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, _______, \
  113. _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, MAC, WINDOWS, TESTMODE,_______, _______, \
  114. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  115. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  116. )
  117. };
  118. void persistent_default_layer_set(uint16_t default_layer) {
  119. eeconfig_update_default_layer(default_layer);
  120. default_layer_set(default_layer);
  121. }
  122. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  123. switch (keycode) {
  124. case MAC:
  125. if (record->event.pressed) {
  126. persistent_default_layer_set(1UL<<_MAC);
  127. }
  128. return false;
  129. break;
  130. case WINDOWS:
  131. if (record->event.pressed) {
  132. persistent_default_layer_set(1UL<<_WINDOWS);
  133. }
  134. return false;
  135. break;
  136. case TESTMODE:
  137. if (record->event.pressed) {
  138. persistent_default_layer_set(1UL<<_TESTMODE);
  139. }
  140. return false;
  141. break;
  142. case LOWER:
  143. if (record->event.pressed) {
  144. layer_on(_LOWER);
  145. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  146. } else {
  147. layer_off(_LOWER);
  148. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  149. }
  150. return false;
  151. break;
  152. case RAISE:
  153. if (record->event.pressed) {
  154. layer_on(_RAISE);
  155. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  156. } else {
  157. layer_off(_RAISE);
  158. update_tri_layer(_LOWER, _RAISE, _ADJUST);
  159. }
  160. return false;
  161. break;
  162. case ADJUST:
  163. if (record->event.pressed) {
  164. layer_on(_ADJUST);
  165. } else {
  166. layer_off(_ADJUST);
  167. }
  168. return false;
  169. break;
  170. }
  171. return true;
  172. }