logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (6637B)


  1. /* Copyright 2020 monksoffunk
  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. // Defines names for use in layer keycodes and the keymap
  18. enum layer_names {
  19. _QWERTY,
  20. _LOWER,
  21. _RAISE,
  22. _ADJUST,
  23. };
  24. // Defines the keycodes used by our macros in process_record_user
  25. enum custom_keycodes {
  26. QWERTY = SAFE_RANGE,
  27. LOWER,
  28. RAISE,
  29. ADJUST,
  30. };
  31. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  32. /* Default Layer
  33. * ,-----------------------------------------------------------.
  34. * | Esc| Q | W | E | R | T | Y | U | I | O | P | BS |
  35. * |-----------------------------------------------------------|
  36. * | Tab | A | S | D | F | G | H | J | K | L | Ent |
  37. * |-----------------------------------------------------------|
  38. * | LSft | Z | X | C | V | B | N | M | , | . |fn(/)|
  39. * |-----------------------------------------------------------|
  40. * | LCtl | LAlt| LGui| spc fn0 | spc fn1 |RGui|RAlt|RCtl|
  41. * `-----------------------------------------------------------'
  42. */
  43. [_QWERTY] = LAYOUT(
  44. KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
  45. KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
  46. KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, LT(_ADJUST, KC_SLSH),
  47. KC_LCTL, KC_LALT , KC_LGUI, LT(_LOWER, KC_SPC), LT(_RAISE, KC_SPC), KC_RGUI, KC_RALT, KC_RCTL
  48. ),
  49. /* Lower Layer
  50. * ,-----------------------------------------------------------.
  51. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del|
  52. * |-----------------------------------------------------------|
  53. * | | | | | | | _ | + | { | } | Pipe |
  54. * |-----------------------------------------------------------|
  55. * | | | | | | | | ; | ' | Up | |
  56. * |-----------------------------------------------------------|
  57. * | | | | | |Left|Down|Right |
  58. * `-----------------------------------------------------------'
  59. */
  60. [_LOWER] = LAYOUT(
  61. KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
  62. _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
  63. _______, _______, _______, _______, _______, _______, _______, KC_SCLN, KC_QUOT, KC_UP, _______,
  64. _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT
  65. ),
  66. /* Raise Layer
  67. * ,-----------------------------------------------------------.
  68. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del|
  69. * |-----------------------------------------------------------|
  70. * | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | Pipe |
  71. * |-----------------------------------------------------------|
  72. * | F7 | F8 | F9 | F10| F11| F12| \ | \ | | | |
  73. * |-----------------------------------------------------------|
  74. * | | | | | | | | |
  75. * `-----------------------------------------------------------'
  76. */
  77. [_RAISE] = LAYOUT(
  78. KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
  79. KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
  80. KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______,
  81. _______, _______, _______, _______, _______, _______, _______, _______
  82. ),
  83. /* Adjust Layer
  84. * ,-----------------------------------------------------------.
  85. * |Mute| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10|F11 |
  86. * |-----------------------------------------------------------|
  87. * | |BTOG |BSTP|BINC| MAC|RGBTOG|HUI|WIN|SAI|VAI| F12 |
  88. * |-----------------------------------------------------------|
  89. * | Caps |Reset|BBRE|BDEC| |RMOD|HUD | |SAD|VAD | |
  90. * |-----------------------------------------------------------|
  91. * |SLEEP| | | | | | | |
  92. * `-----------------------------------------------------------'
  93. */
  94. [_ADJUST] = LAYOUT(
  95. KC_MUTE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
  96. _______, BL_TOGG, BL_STEP, BL_UP, AG_NORM, UG_TOGG, UG_HUEU, AG_SWAP, UG_SATU, UG_VALU, KC_F12,
  97. KC_CAPS, QK_BOOT, BL_BRTG, BL_DOWN, _______, UG_NEXT, UG_HUED, _______, UG_SATD, UG_VALD, _______,
  98. KC_SLEP, _______, _______, _______, _______, _______, _______, _______
  99. ),
  100. };
  101. bool encoder_update_user(uint8_t index, bool clockwise) {
  102. if (index == 0) { /* Left encoder */
  103. switch (get_highest_layer(layer_state)) {
  104. case _QWERTY:
  105. if (clockwise) {
  106. tap_code(KC_TAB);
  107. } else {
  108. tap_code16(S(KC_TAB));
  109. }
  110. break;
  111. case _RAISE:
  112. if (clockwise) {
  113. // tap_code(KC_VOLU);
  114. if(keymap_config.swap_lalt_lgui==false){
  115. tap_code(KC_LNG2);
  116. }else {
  117. tap_code16(A(KC_GRV));
  118. }
  119. } else {
  120. if(keymap_config.swap_lalt_lgui==false){
  121. tap_code(KC_LNG1);
  122. } else {
  123. tap_code16(A(KC_GRV));
  124. }
  125. }
  126. break;
  127. case _ADJUST:
  128. if (clockwise) {
  129. tap_code(KC_VOLU);
  130. } else {
  131. tap_code(KC_VOLD);
  132. }
  133. }
  134. } else if (index == 1) { /* Right encoder */
  135. if (clockwise) {
  136. tap_code(KC_PGDN);
  137. } else {
  138. tap_code(KC_PGUP);
  139. }
  140. }
  141. return true;
  142. }