You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
8.6 KiB

  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 SHIFT_MOD MOD_BIT(KC_LSFT)
  23. #define SPACE_RAISE LT(_RAISE, KC_SPC)
  24. #define ENT_RAISE LT(_RAISE, KC_ENT)
  25. #define PAGE_PREV S(LCTL(KC_TAB))
  26. #define PAGE_NEXT LCTL(KC_TAB)
  27. enum custom_keycodes
  28. {
  29. LO_BSPC = SAFE_RANGE,
  30. LO_1,
  31. LO_2,
  32. LO_3,
  33. LO_4,
  34. LO_5,
  35. LO_6,
  36. LO_7,
  37. LO_8,
  38. LO_9,
  39. LO_0,
  40. };
  41. bool process_record_user(uint16_t keycode, keyrecord_t* record)
  42. {
  43. if (record->event.pressed) {
  44. switch (keycode) {
  45. case LO_BSPC:
  46. if (record->event.pressed) {
  47. if (get_mods() & SHIFT_MOD) {
  48. uint8_t current_mods = get_mods();
  49. clear_mods();
  50. SEND_STRING(SS_TAP(X_DELETE));
  51. set_mods(current_mods);
  52. } else {
  53. SEND_STRING(SS_TAP(X_BSPACE));
  54. }
  55. }
  56. return false;
  57. case LO_1:
  58. if (record->event.pressed) {
  59. uint8_t current_mods = get_mods();
  60. if (current_mods & SHIFT_MOD) {
  61. clear_mods();
  62. SEND_STRING("1");
  63. set_mods(current_mods);
  64. } else {
  65. SEND_STRING("!");
  66. }
  67. }
  68. return false;
  69. case LO_2:
  70. if (record->event.pressed) {
  71. uint8_t current_mods = get_mods();
  72. if (current_mods & SHIFT_MOD) {
  73. clear_mods();
  74. SEND_STRING("2");
  75. set_mods(current_mods);
  76. } else {
  77. SEND_STRING("@");
  78. }
  79. }
  80. return false;
  81. case LO_3:
  82. if (record->event.pressed) {
  83. uint8_t current_mods = get_mods();
  84. if (current_mods & SHIFT_MOD) {
  85. clear_mods();
  86. SEND_STRING("3");
  87. set_mods(current_mods);
  88. } else {
  89. SEND_STRING("#");
  90. }
  91. }
  92. return false;
  93. case LO_4:
  94. if (record->event.pressed) {
  95. uint8_t current_mods = get_mods();
  96. if (current_mods & SHIFT_MOD) {
  97. clear_mods();
  98. SEND_STRING("4");
  99. set_mods(current_mods);
  100. } else {
  101. SEND_STRING("$");
  102. }
  103. }
  104. return false;
  105. case LO_5:
  106. if (record->event.pressed) {
  107. uint8_t current_mods = get_mods();
  108. if (current_mods & SHIFT_MOD) {
  109. clear_mods();
  110. SEND_STRING("5");
  111. set_mods(current_mods);
  112. } else {
  113. SEND_STRING("%");
  114. }
  115. }
  116. return false;
  117. case LO_6:
  118. if (record->event.pressed) {
  119. uint8_t current_mods = get_mods();
  120. if (current_mods & SHIFT_MOD) {
  121. clear_mods();
  122. SEND_STRING("6");
  123. set_mods(current_mods);
  124. } else {
  125. SEND_STRING("^");
  126. }
  127. }
  128. return false;
  129. case LO_7:
  130. if (record->event.pressed) {
  131. uint8_t current_mods = get_mods();
  132. if (current_mods & SHIFT_MOD) {
  133. clear_mods();
  134. SEND_STRING("7");
  135. set_mods(current_mods);
  136. } else {
  137. SEND_STRING("&");
  138. }
  139. }
  140. return false;
  141. case LO_8:
  142. if (record->event.pressed) {
  143. uint8_t current_mods = get_mods();
  144. if (current_mods & SHIFT_MOD) {
  145. clear_mods();
  146. SEND_STRING("8");
  147. set_mods(current_mods);
  148. } else {
  149. SEND_STRING("*");
  150. }
  151. }
  152. return false;
  153. case LO_9:
  154. if (record->event.pressed) {
  155. uint8_t current_mods = get_mods();
  156. if (current_mods & SHIFT_MOD) {
  157. clear_mods();
  158. SEND_STRING("9");
  159. set_mods(current_mods);
  160. } else {
  161. SEND_STRING("(");
  162. }
  163. }
  164. return false;
  165. case LO_0:
  166. if (record->event.pressed) {
  167. uint8_t current_mods = get_mods();
  168. if (current_mods & SHIFT_MOD) {
  169. clear_mods();
  170. SEND_STRING("0");
  171. set_mods(current_mods);
  172. } else {
  173. SEND_STRING(")");
  174. }
  175. }
  176. return false;
  177. }
  178. }
  179. return true;
  180. };
  181. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  182. [_WORKMAN_P] = LAYOUT(
  183. 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,
  184. 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,
  185. 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,
  186. 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,
  187. 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),
  188. [_GAME] = LAYOUT(
  189. 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,
  190. 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,
  191. 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,
  192. 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,
  193. 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),
  194. [_RAISE] = LAYOUT(
  195. _______, 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,
  196. _______, _______, _______, _______, _______, _______, BL_INC, KC_VOLU, _______, _______, _______, _______, _______, KC_F12,
  197. _______, _______, _______, _______, _______, _______, BL_DEC, KC_VOLD, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______,
  198. _______, _______, _______, _______, _______, _______, BL_BRTG, KC_MUTE, _______, _______, KC_MPRV, KC_MNXT, KC_MPLY, _______,
  199. _______, _______, _______, _______, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______),
  200. };