keymap.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* Copyright 2021 David Rambo
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  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. enum custom_layers {
  18. _COLEMAK,
  19. _SYMBOL,
  20. _NAVIGATION,
  21. _FKEYS,
  22. };
  23. //keycode shorthands
  24. #define SYM MO(1)
  25. #define NAV LT(2, KC_ESC)
  26. #define FKEY MO(3)
  27. //aliases for clarity in layering
  28. #define SftEnt SFT_T(KC_ENT) // Shift when held, Enter when tapped
  29. #define BSCTL LCTL_T(KC_BSPC) // Ctrl when held, Backspace when tapped
  30. #define CTAB LCTL(KC_TAB)
  31. #define ATAB LALT(KC_TAB)
  32. //aliases for Navigation layer
  33. #define CBSPC LCTL(KC_BSPC) // delete whole word
  34. #define C_CL LCTL(KC_LEFT) // move cursor one word back
  35. #define C_CR LCTL(KC_RGHT) // move cursor one word forward
  36. //internet browser tab shortcuts and window swapping
  37. #define CTLPGDN LCTL(KC_PGDN)
  38. #define CTLPGUP LCTL(KC_PGUP)
  39. #define G_GRV LGUI(KC_GRV)
  40. #define SftEnt SFT_T(KC_ENT)
  41. enum custom_keycodes {
  42. PLACEHOLDER = SAFE_RANGE,
  43. SET_RGB,
  44. };
  45. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  46. [_COLEMAK] = LAYOUT(
  47. //,-----------------------------------------------------. ,-----------------------------------------------------.
  48. KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
  49. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  50. NAV , KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O , KC_QUOT,
  51. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  52. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SftEnt,
  53. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  54. KC_LALT, KC_LGUI, BSCTL, KC_SPC, SYM , FKEY
  55. //`--------------------------' `--------------------------'
  56. ),
  57. [_SYMBOL] = LAYOUT(
  58. //,-----------------------------------------------------. ,-----------------------------------------------------.
  59. KC_LBRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC,
  60. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  61. KC_BSLS, KC_EXLM, KC_AT , KC_HASH, KC_DLR , KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_EQL ,
  62. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  63. _______, KC_HOME, KC_END, _______, _______, _______, KC_GRV, KC_MINS, KC_PGUP, _______, _______, _______,
  64. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  65. _______, _______, _______, _______, _______, KC_PGDN
  66. //`--------------------------' `--------------------------'
  67. ),
  68. [_NAVIGATION] = LAYOUT(
  69. //,-----------------------------------------------------. ,-----------------------------------------------------.
  70. _______, _______, _______, _______, _______, _______, CTAB , C_CL , KC_UP, C_CR , KC_DEL, _______,
  71. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  72. _______, _______, _______, _______, _______, _______, CTLPGUP, KC_LEFT , KC_DOWN, KC_RGHT, CTLPGDN, _______,
  73. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  74. QK_BOOT, _______, _______, _______, _______, _______, ATAB , CBSPC , KC_HOME, KC_END, G_GRV , _______,
  75. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  76. _______, _______, _______, _______, _______, KC_RALT
  77. //`--------------------------' `--------------------------'
  78. ),
  79. [_FKEYS] = LAYOUT(
  80. //,-----------------------------------------------------. ,-----------------------------------------------------.
  81. KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
  82. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  83. _______, RGB_SAI, RGB_HUI, RGB_VAI, RGB_TOG, SET_RGB, _______, _______, _______, _______, _______, _______,
  84. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  85. _______, RGB_MOD, RGB_M_P, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______, _______, _______, _______,
  86. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  87. _______, _______, _______, _______, _______, _______
  88. //`--------------------------' `--------------------------'
  89. )
  90. };
  91. void keyboard_post_init_user(void) {
  92. // rgb_matrix_sethsv(191, 43, 81);
  93. rgblight_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP);
  94. };
  95. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  96. switch (keycode) {
  97. case SET_RGB:
  98. if (record->event.pressed) {
  99. rgb_matrix_sethsv_noeeprom(18, 86, 95);
  100. }
  101. return false;
  102. break;
  103. }
  104. return true;
  105. }