2
0

keymap.c 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /* Copyright 2017 IslandMan93
  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. // KEYMAP
  18. extern keymap_config_t keymap_config;
  19. #define _WORKMAN_P 0
  20. #define _GAME 1
  21. #define _RAISE 2
  22. #define _______ KC_TRNS
  23. #define SHIFT_MOD MOD_BIT(KC_LSFT)
  24. #define SPACE_RAISE LT(_RAISE, KC_SPC)
  25. #define ENT_RAISE LT(_RAISE, KC_ENT)
  26. #define PAGE_PREV S(LCTL(KC_TAB))
  27. #define PAGE_NEXT LCTL(KC_TAB)
  28. enum custom_keycodes
  29. {
  30. LO_BSPC = SAFE_RANGE,
  31. LO_1,
  32. LO_2,
  33. LO_3,
  34. LO_4,
  35. LO_5,
  36. LO_6,
  37. LO_7,
  38. LO_8,
  39. LO_9,
  40. LO_0,
  41. };
  42. bool process_record_user(uint16_t keycode, keyrecord_t* record)
  43. {
  44. if (record->event.pressed) {
  45. switch (keycode) {
  46. case LO_BSPC:
  47. if (record->event.pressed) {
  48. if (get_mods() & SHIFT_MOD) {
  49. uint8_t current_mods = get_mods();
  50. clear_mods();
  51. SEND_STRING(SS_TAP(X_DELETE));
  52. set_mods(current_mods);
  53. } else {
  54. SEND_STRING(SS_TAP(X_BSPACE));
  55. }
  56. }
  57. return false;
  58. case LO_1:
  59. if (record->event.pressed) {
  60. uint8_t current_mods = get_mods();
  61. if (current_mods & SHIFT_MOD) {
  62. clear_mods();
  63. SEND_STRING("1");
  64. set_mods(current_mods);
  65. } else {
  66. SEND_STRING("!");
  67. }
  68. }
  69. return false;
  70. case LO_2:
  71. if (record->event.pressed) {
  72. uint8_t current_mods = get_mods();
  73. if (current_mods & SHIFT_MOD) {
  74. clear_mods();
  75. SEND_STRING("2");
  76. set_mods(current_mods);
  77. } else {
  78. SEND_STRING("@");
  79. }
  80. }
  81. return false;
  82. case LO_3:
  83. if (record->event.pressed) {
  84. uint8_t current_mods = get_mods();
  85. if (current_mods & SHIFT_MOD) {
  86. clear_mods();
  87. SEND_STRING("3");
  88. set_mods(current_mods);
  89. } else {
  90. SEND_STRING("#");
  91. }
  92. }
  93. return false;
  94. case LO_4:
  95. if (record->event.pressed) {
  96. uint8_t current_mods = get_mods();
  97. if (current_mods & SHIFT_MOD) {
  98. clear_mods();
  99. SEND_STRING("4");
  100. set_mods(current_mods);
  101. } else {
  102. SEND_STRING("$");
  103. }
  104. }
  105. return false;
  106. case LO_5:
  107. if (record->event.pressed) {
  108. uint8_t current_mods = get_mods();
  109. if (current_mods & SHIFT_MOD) {
  110. clear_mods();
  111. SEND_STRING("5");
  112. set_mods(current_mods);
  113. } else {
  114. SEND_STRING("%");
  115. }
  116. }
  117. return false;
  118. case LO_6:
  119. if (record->event.pressed) {
  120. uint8_t current_mods = get_mods();
  121. if (current_mods & SHIFT_MOD) {
  122. clear_mods();
  123. SEND_STRING("6");
  124. set_mods(current_mods);
  125. } else {
  126. SEND_STRING("^");
  127. }
  128. }
  129. return false;
  130. case LO_7:
  131. if (record->event.pressed) {
  132. uint8_t current_mods = get_mods();
  133. if (current_mods & SHIFT_MOD) {
  134. clear_mods();
  135. SEND_STRING("7");
  136. set_mods(current_mods);
  137. } else {
  138. SEND_STRING("&");
  139. }
  140. }
  141. return false;
  142. case LO_8:
  143. if (record->event.pressed) {
  144. uint8_t current_mods = get_mods();
  145. if (current_mods & SHIFT_MOD) {
  146. clear_mods();
  147. SEND_STRING("8");
  148. set_mods(current_mods);
  149. } else {
  150. SEND_STRING("*");
  151. }
  152. }
  153. return false;
  154. case LO_9:
  155. if (record->event.pressed) {
  156. uint8_t current_mods = get_mods();
  157. if (current_mods & SHIFT_MOD) {
  158. clear_mods();
  159. SEND_STRING("9");
  160. set_mods(current_mods);
  161. } else {
  162. SEND_STRING("(");
  163. }
  164. }
  165. return false;
  166. case LO_0:
  167. if (record->event.pressed) {
  168. uint8_t current_mods = get_mods();
  169. if (current_mods & SHIFT_MOD) {
  170. clear_mods();
  171. SEND_STRING("0");
  172. set_mods(current_mods);
  173. } else {
  174. SEND_STRING(")");
  175. }
  176. }
  177. return false;
  178. }
  179. }
  180. return true;
  181. };
  182. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  183. [_WORKMAN_P] = LAYOUT(
  184. KC_ESC, LO_1, LO_2, LO_3, LO_4, LO_5, LO_6, LO_6, LO_7, LO_8, LO_9, LO_0, KC_MINS, KC_ESC,
  185. KC_GRV, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_LPRN, KC_RPRN, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_EQL,
  186. KC_TAB, KC_A, KC_S, KC_H, KC_T, KC_G, KC_LCBR, KC_RCBR, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_BSLS,
  187. KC_LCTL, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_LBRC, KC_RBRC, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
  188. KC_LSFT, RESET, PAGE_PREV, PAGE_NEXT, KC_END, KC_LGUI, KC_LALT, TG(_GAME), LO_BSPC, ENT_RAISE, SPACE_RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RCTL),
  189. [_GAME] = LAYOUT(
  190. KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_ESC,
  191. KC_GRV, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_LPRN, KC_RPRN, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_EQL,
  192. KC_TAB, KC_A, KC_S, KC_H, KC_T, KC_G, KC_LCBR, KC_RCBR, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_BSLS,
  193. KC_LCTL, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_LBRC, KC_RBRC, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
  194. KC_LSFT, KC_F1, KC_F2, KC_3, KC_F5, KC_SPC, KC_LALT, TG(_GAME), LO_BSPC, ENT_RAISE, SPACE_RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RCTL),
  195. [_RAISE] = LAYOUT(
  196. _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, RESET,
  197. _______, _______, _______, _______, _______, _______, BL_INC, KC_VOLU, _______, _______, _______, _______, _______, KC_F12,
  198. _______, _______, _______, _______, _______, _______, BL_DEC, KC_VOLD, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______,
  199. _______, _______, _______, _______, _______, _______, BL_BRTG, KC_MUTE, _______, _______, KC_MPRV, KC_MNXT, KC_MPLY, _______,
  200. _______, _______, _______, _______, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______),
  201. };