keymap.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. #include QMK_KEYBOARD_H
  2. #include "version.h"
  3. enum layers {
  4. _BL = 0, // Base Layer
  5. _WL, // Workman Layer
  6. _NL, // Norman Layer
  7. _DL, // Dvorak Layer
  8. _CL, // Base Layer
  9. _FL, // Function Layer
  10. _AL, // Adjust Layer
  11. };
  12. enum custom_keycodes {
  13. DYNAMIC_MACRO_RANGE = SAFE_RANGE,
  14. QMK_REV,
  15. KC_WEB,
  16. KC_SP4
  17. };
  18. extern backlight_config_t backlight_config;
  19. #include "dynamic_macro.h"
  20. #define FN_CAPS LT(_FL, KC_CAPS)
  21. #define KC_DMR1 DYN_REC_START1
  22. #define KC_DMR2 DYN_REC_START2
  23. #define KC_DMP1 DYN_MACRO_PLAY1
  24. #define KC_DMP2 DYN_MACRO_PLAY2
  25. #define KC_DMRS DYN_REC_STOP
  26. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  27. /*#### _BL: Base Layer - Standard TKL QWERTY layout.
  28. * .-----------------------------------------------------------------------.
  29. * |Esc|||||F1 |F2 |F3 |F4 |||F5 |F6 |F7 |F8 |||F9 |F10|F11|F12|PSc|SLk|Pau|
  30. * |-----------------------------------------------------------|-----------|
  31. * |~ |1 |2 |3 |4 |5 |6 |7 |8 |9 |0 |- |= |Backsp |Ins|Hom|PgU|
  32. * |-----------------------------------------------------------|-----------|
  33. * |Tab |Q |W |E |R |T |Y |U |I |O |P |[ |] |\ |Del|End|PgD|
  34. * |-----------------------------------------------------------|-----------|
  35. * |Caps |A |S |D |F |G |H |J |K |L |; |' |Return | |
  36. * |-----------------------------------------------------------|-----------|
  37. * |Shift |Z |X |C |V |B |N |M |, |. |/ |Shift |Fn | | Up| |
  38. * |-----------------------------------------------------------|-----------|
  39. * |Ctrl |Win|Alt | Space |RAlt |Fn |Ctrl |Lft|Dwn|Rgt|
  40. * *-----------------------------------------------------------------------*
  41. */
  42. [_BL] = LAYOUT_tkl( \
  43. KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, \
  44. KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, \
  45. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \
  46. KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, KC_ENT, \
  47. KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_FL), KC_UP, \
  48. KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RGUI, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
  49. ),
  50. /*#### _WL: Workman Layer.
  51. * .-----------------------------------------------------------------------.
  52. * | ||||| | | | ||| | | | ||| | | | | | | |
  53. * .-----------------------------------------------------------|-----------|
  54. * | | | | | | | | | | | |- |= | | | | |
  55. * |-----------------------------------------------------------|-----------|
  56. * | |Q |D |R |W |B |J |F |U |P |; |[ |] |\ | | | |
  57. * |-----------------------------------------------------------|-----------|
  58. * | |A |S |H |T |G |Y |N |E |O |I |' | | |
  59. * |-----------------------------------------------------------|-----------|
  60. * | |Z |X |M |C |V |K |L |, |. |/ | | | | | |
  61. * |-----------------------------------------------------------|-----------|
  62. * | | | | | | | | | | |
  63. * *-----------------------------------------------------------------------*
  64. */
  65. [_WL] = LAYOUT_tkl( \
  66. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  67. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  68. _______, KC_Q , KC_D , KC_R , KC_W , KC_B , KC_J , KC_F , KC_U , KC_P , KC_SCLN, _______, _______, _______, _______, _______, _______, \
  69. _______, KC_A , KC_S , KC_H , KC_T , KC_G , KC_Y , KC_N , KC_E , KC_O , KC_I , _______, _______, _______, \
  70. _______, _______, KC_Z , KC_X , KC_M , KC_C , KC_V , KC_K , KC_L , KC_COMM, KC_DOT , KC_SLSH, _______, _______, _______, \
  71. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  72. ),
  73. /*#### _NL: Norman Layer.
  74. * .-----------------------------------------------------------------------.
  75. * | ||||| | | | ||| | | | ||| | | | | | | |
  76. * .-----------------------------------------------------------|-----------|
  77. * | | | | | | | | | | | |- |= | | | | |
  78. * |-----------------------------------------------------------|-----------|
  79. * | |Q |W |D |F |K |J |U |R |L |; |[ |] |\ | | | |
  80. * |-----------------------------------------------------------|-----------|
  81. * | |A |S |E |T |G |Y |N |I |O |H |' | | |
  82. * |-----------------------------------------------------------|-----------|
  83. * | |Z |X |C |V |B |P |M |, |. |/ | | | | | |
  84. * |-----------------------------------------------------------|-----------|
  85. * | | | | | | | | | | |
  86. * *-----------------------------------------------------------------------*
  87. */
  88. [_NL] = LAYOUT_tkl( \
  89. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  90. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  91. _______, KC_Q , KC_W , KC_D , KC_F , KC_K , KC_J , KC_U , KC_R , KC_L , KC_SCLN, _______, _______, _______, _______, _______, _______, \
  92. _______, KC_A , KC_S , KC_E , KC_T , KC_G , KC_Y , KC_N , KC_I , KC_O , KC_H , _______, _______, _______, \
  93. _______, _______, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_P , KC_M , KC_COMM, KC_DOT , KC_SLSH, _______, _______, _______, \
  94. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  95. ),
  96. /*#### _DL: Dvorak Layer.
  97. * .-----------------------------------------------------------------------.
  98. * | ||||| | | | ||| | | | ||| | | | | | | |
  99. * .-----------------------------------------------------------|-----------|
  100. * | | | | | | | | | | | |[ |] | | | | |
  101. * |-----------------------------------------------------------|-----------|
  102. * | |' |, |. |P |Y |F |G |C |R |L |/ |= |\ | | | |
  103. * |-----------------------------------------------------------|-----------|
  104. * | |A |O |E |U |I |D |H |T |N |S |- | | |
  105. * |-----------------------------------------------------------|-----------|
  106. * | |; |Q |J |K |X |B |M |W |V |Z | | | | | |
  107. * |-----------------------------------------------------------|-----------|
  108. * | | | | | | | | | | |
  109. * *-----------------------------------------------------------------------*
  110. */
  111. [_DL] = LAYOUT_tkl( \
  112. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  113. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, _______, _______, \
  114. _______, KC_QUOT, KC_COMM, KC_DOT , KC_P , KC_Y , KC_F , KC_G , KC_C , KC_R , KC_L , KC_SLSH, KC_EQL , _______, _______, _______, _______, \
  115. _______, KC_A , KC_O , KC_E , KC_U , KC_I , KC_D , KC_H , KC_T , KC_N , KC_S , KC_MINS, _______, _______, \
  116. _______, _______, KC_SCLN, KC_Q , KC_J , KC_K , KC_X , KC_B , KC_M , KC_W , KC_V , KC_Z , _______, _______, _______, \
  117. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  118. ),
  119. /*#### _CL: Colmak Layer.
  120. * .-----------------------------------------------------------------------.
  121. * | ||||| | | | ||| | | | ||| | | | | | | |
  122. * .-----------------------------------------------------------|-----------|
  123. * | | | | | | | | | | | |- |= | | | | |
  124. * |-----------------------------------------------------------|-----------|
  125. * | |Q |W |F |P |G |J |L |U |Y |; |[ |] |\ | | | |
  126. * |-----------------------------------------------------------|-----------|
  127. * | |A |R |S |T |D |H |N |E |I |O |' | | |
  128. * |-----------------------------------------------------------|-----------|
  129. * | |Z |X |C |V |B |K |M |, |. |/ | | | | | |
  130. * |-----------------------------------------------------------|-----------|
  131. * | | | | | | | | | | |
  132. * *-----------------------------------------------------------------------*
  133. */
  134. [_CL] = LAYOUT_tkl( \
  135. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  136. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  137. _______, KC_Q , KC_W , KC_F , KC_P , KC_G , KC_J , KC_L , KC_U , KC_Y , KC_SCLN, _______, _______, _______, _______, _______, _______, \
  138. _______, KC_A , KC_R , KC_S , KC_T , KC_D , KC_H , KC_N , KC_E , KC_I , KC_O , _______, _______, _______, \
  139. _______, _______, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_K , KC_M , KC_COMM, KC_DOT , KC_SLSH, _______, _______, _______, \
  140. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  141. ),
  142. /*#### _FL: Function Layer.
  143. * .-----------------------------------------------------------------------.
  144. * | ||||| | | | ||| | | | ||| |VlM|VlD|VlU| | | |
  145. * .-----------------------------------------------------------|-----------|
  146. * |Web| | | | | | | | | | | | | | | | |
  147. * |-----------------------------------------------------------|-----------|
  148. * |Fn_AL| | | | | | | | | | | | | | | | |
  149. * |-----------------------------------------------------------|-----------|
  150. * | | | | | | | |Lft|Dwn|Up |Rgt| | | |
  151. * |-----------------------------------------------------------|-----------|
  152. * | | | | | | | | | | | | |Fn | | | |
  153. * |-----------------------------------------------------------|-----------|
  154. * | | | | SP4 | |Fn | |WBk| |WFw|
  155. * *-----------------------------------------------------------------------*
  156. */
  157. [_FL] = LAYOUT_tkl( \
  158. XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, XXXXXXX, XXXXXXX, \
  159. KC_WEB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
  160. MO(_AL), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
  161. XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
  162. XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, \
  163. XXXXXXX, XXXXXXX, KC_MENU, KC_SP4, XXXXXXX, _______, XXXXXXX, XXXXXXX, KC_WBAK, XXXXXXX, KC_WFWD \
  164. ),
  165. /*#### _AL: Adjust Layer - Keymap select, LED backlight, and Dynamic Macro settings.
  166. * .-----------------------------------------------------------------------.
  167. * |Rst||||| | | | ||| | | | ||| | | | | | | |
  168. * .-----------------------------------------------------------|-----------|
  169. * |Rev|Tog|Mod|H- |H+ |S- |S+ |V- |V+ | |BLT|BL-|BL+| | |MR1|MP1|
  170. * |-----------------------------------------------------------|-----------|
  171. * |Fn_AL|_BL|_WL| | | | | | | | | | | | MS|MR2|MP2|
  172. * |-----------------------------------------------------------|-----------|
  173. * | | | |_DL| | | | | | | | | | |
  174. * |-----------------------------------------------------------|-----------|
  175. * | | | |_CL| |_BL|_NL| | | | | |Fn | | | |
  176. * |-----------------------------------------------------------|-----------|
  177. * | | | | | |Fn | | | | |
  178. * *-----------------------------------------------------------------------*
  179. */
  180. [_AL] = LAYOUT_tkl( \
  181. RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
  182. QMK_REV, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, XXXXXXX, BL_TOGG, BL_DEC, BL_INC, XXXXXXX, XXXXXXX, KC_DMR1, KC_DMP1, \
  183. _______, DF(_BL), DF(_WL), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_DMRS, KC_DMR2, KC_DMP2, \
  184. XXXXXXX, XXXXXXX, XXXXXXX, DF(_DL), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
  185. XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF(_CL), XXXXXXX, DF(_BL), DF(_NL), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, \
  186. XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \
  187. ),
  188. };
  189. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  190. switch (keycode) {
  191. case QMK_REV:
  192. if (record->event.pressed) {
  193. SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP "@" QMK_VERSION ":" QMK_BUILDDATE);
  194. }
  195. return false;
  196. break;
  197. case KC_WEB:
  198. if (record->event.pressed) {
  199. SEND_STRING(SS_LGUI("r"));
  200. wait_ms(100);
  201. SEND_STRING("chrome.exe\n");
  202. }
  203. return false;
  204. break;
  205. case KC_SP4:
  206. if (record->event.pressed) {
  207. SEND_STRING (" ");
  208. }
  209. return false;
  210. break;
  211. }
  212. // Dynamic Macros.
  213. if (!process_record_dynamic_macro(keycode, record)) {
  214. return false;
  215. }
  216. return true;
  217. }
  218. void custom_backlight_level(uint8_t level) {
  219. if (level > BACKLIGHT_LEVELS)
  220. level = BACKLIGHT_LEVELS;
  221. backlight_config.level = level;
  222. backlight_config.enable = !!backlight_config.level;
  223. backlight_set(backlight_config.level);
  224. }
  225. void matrix_init_user(void) {
  226. #ifdef BACKLIGHT_ENABLE
  227. custom_backlight_level(0);
  228. #endif
  229. }
  230. void matrix_scan_user(void) {
  231. }
  232. uint32_t layer_state_set_user(uint32_t state) {
  233. switch (biton32(state)) {
  234. case _BL:
  235. custom_backlight_level(0);
  236. break;
  237. case _WL:
  238. case _NL:
  239. case _DL:
  240. case _CL:
  241. custom_backlight_level(1);
  242. break;
  243. case _FL:
  244. custom_backlight_level(2);
  245. break;
  246. case _AL:
  247. custom_backlight_level(3);
  248. break;
  249. default:
  250. custom_backlight_level(0);
  251. break;
  252. }
  253. return state;
  254. }
  255. void led_set_user(uint8_t usb_led) {
  256. }