logo

qmk_firmware

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

keymap.c (7853B)


  1. /*
  2. Copyright 2016 Julien Pecqueur <julien@peclu.net>
  3. Copyright 2016 Felix Uhl <ifreilicht@gmail.com>
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License, or
  7. (at your option) any later version.
  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. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #include QMK_KEYBOARD_H
  16. #define ONESHOT_TAP_TOGGLE 2
  17. #define ONESHOT_TIMEOUT 1
  18. //uncomment to activate dead keys
  19. //#define DONT_REVIVE_DEADKEYS 1
  20. //Function keycodes for better readability
  21. //SpaceFN
  22. //OneShot LeftShift
  23. //GamingMode Lock (disables SpaceFn and OneShot LShift)
  24. //Function
  25. //Mute microphone
  26. #define KC_SPACEFN LT(2, KC_SPACE)
  27. #define KC_OSLS OSM(MOD_LSFT)
  28. #define KC_GMLK TG(1)
  29. #define KC_FUNC MO(2)
  30. #define MICMUTE RCTL(KC_LCTL)
  31. enum layer_names {
  32. DEFAULT,
  33. GAMING,
  34. FUNCTION
  35. };
  36. enum languages {
  37. GERMAN
  38. };
  39. #define LANGUAGE GERMAN
  40. enum custom_keycodes {
  41. KC_CM_A = SAFE_RANGE,
  42. // KC_CM_B,
  43. KC_CM_C,
  44. // KC_CM_D,
  45. KC_CM_E,
  46. // KC_CM_F,
  47. KC_CM_G,
  48. // KC_CM_H,
  49. KC_CM_I,
  50. // KC_CM_J,
  51. KC_CM_K,
  52. KC_CM_L,
  53. KC_CM_M,
  54. KC_CM_N,
  55. KC_CM_O,
  56. KC_CM_P,
  57. // KC_CM_Q,
  58. KC_CM_R,
  59. KC_CM_S,
  60. // KC_CM_T,
  61. KC_CM_U,
  62. // KC_CM_V,
  63. KC_CM_W,
  64. // KC_CM_X,
  65. KC_CM_Y,
  66. KC_CM_Z
  67. };
  68. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  69. /* Layout 0: Default Layer
  70. * ,-----------------------------------------------------------.
  71. * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \|Del|
  72. * |-----------------------------------------------------------|
  73. * |Tab | Q| W| E| R| T| Z| U| I| O| P| [| ]|BckSp|
  74. * |-----------------------------------------------------------|
  75. * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return |
  76. * |-----------------------------------------------------------|
  77. * |Shift | Y| X| C| V| B| N| M| ,| .| /| Up |RSft|
  78. * |-----------------------------------------------------------|
  79. * |Fn2 |Gui |Alt | SpaceFn |Alt |Left|Down|Right|
  80. * `-----------------------------------------------------------'
  81. */
  82. [DEFAULT] = LAYOUT(
  83. KC_ESC, 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_BSLS, KC_DEL,
  84. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
  85. KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT,
  86. KC_LSFT, KC_NUBS, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT,
  87. KC_FUNC, KC_LGUI, KC_LALT, KC_SPACEFN, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT
  88. ),
  89. /* Layout 1: Gaming Layer, SpaceFn disabled
  90. * ,-----------------------------------------------------------.
  91. * | | | | | | | | | | | | | | | |
  92. * |-----------------------------------------------------------|
  93. * | | | | | | | | | | | | | | |
  94. * |-----------------------------------------------------------|
  95. * | | | | | | | | | | | | | |
  96. * |-----------------------------------------------------------|
  97. * | | | | | | | | | | | | |Fn1 |
  98. * |-----------------------------------------------------------|
  99. * | |RSft| | Space | | | | |
  100. * `-----------------------------------------------------------'
  101. */
  102. [GAMING] = LAYOUT(
  103. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  104. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  105. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
  106. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_GMLK,
  107. _______, KC_RSFT, _______, KC_SPC, _______, _______, _______, _______
  108. ),
  109. /* Layout 2: Function Layer
  110. * MicMute requires special software to be installed. Check readme.md for more information
  111. * ,-----------------------------------------------------------.
  112. * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|RES|
  113. * |-----------------------------------------------------------|
  114. * | | | | |Prv|Ply|Nxt| � | | � | |Prt|Slk|Pau |
  115. * |-----------------------------------------------------------|
  116. * | | � | � | |Vl-|Mut|Vl+| | | | | |PEnt |
  117. * |-----------------------------------------------------------|
  118. * | | | | |MicMut|Cal| | | | |Pau |PUp |Fn1 |
  119. * |-----------------------------------------------------------|
  120. * | | | | | |Home|PDn |End |
  121. * `-----------------------------------------------------------'
  122. */
  123. [FUNCTION] = LAYOUT(
  124. KC_GRV, 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_INS, QK_BOOT,
  125. _______, _______, KC_CM_W, KC_CM_E, KC_MPRV, KC_MPLY, KC_MNXT, KC_CM_U, KC_CM_I, KC_CM_O, KC_CM_P, KC_PSCR, KC_SCRL, KC_PAUS,
  126. _______, KC_CM_A, KC_CM_S, _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, KC_CM_K, KC_CM_L, _______, _______, _______, KC_PENT,
  127. _______, _______, KC_CM_Y, _______, KC_CM_C, MICMUTE, KC_CALC, KC_CM_N, KC_CM_M, _______, _______, _______, KC_PGUP, KC_GMLK,
  128. _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END
  129. ),
  130. };
  131. bool process_german(uint16_t keycode, keyrecord_t *record) {
  132. uint16_t send_code = 0;
  133. if (record->event.pressed) {
  134. switch (keycode) {
  135. case KC_CM_A:
  136. send_code = KC_Q;
  137. break;
  138. case KC_CM_O:
  139. send_code = KC_P;
  140. break;
  141. case KC_CM_U:
  142. send_code = KC_Y;
  143. break;
  144. case KC_CM_S:
  145. send_code = KC_S;
  146. break;
  147. }
  148. if (send_code == 0) {
  149. return true;
  150. }
  151. else {
  152. register_code(KC_RALT);
  153. register_code(send_code);
  154. unregister_code(send_code);
  155. unregister_code(KC_RALT);
  156. return false;
  157. }
  158. }
  159. return true;
  160. }
  161. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  162. //revive dead keys
  163. #ifndef DONT_REVIVE_DEADKEYS
  164. bool shift_active = keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_LSFT));
  165. bool altgr_active = keyboard_report->mods & (MOD_BIT(KC_RALT));
  166. if ((keycode == KC_QUOT && !altgr_active) ||
  167. keycode == KC_GRV ||
  168. (keycode == KC_6 && shift_active))
  169. {
  170. if (record->event.pressed) {
  171. register_code(keycode);
  172. unregister_code(keycode);
  173. register_code(KC_SPACE);
  174. unregister_code(KC_SPACE);
  175. }
  176. return false;
  177. }
  178. #endif
  179. #if LANGUAGE == GERMAN
  180. return process_german(keycode, record);
  181. #else
  182. return true;
  183. #endif
  184. }