logo

qmk_firmware

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

keymap.c (3353B)


  1. /*
  2. Copyright 2021 Richard Snijder
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. uint16_t copy_paste_timer;
  16. uint16_t enter_timer;
  17. //extern rgblight_config_t rgblight_config;
  18. // Define custom keycodes
  19. enum my_keycodes {
  20. KC_CCCV = SAFE_RANGE,
  21. KC_2ENTER
  22. };
  23. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  24. //Layer 0 - Base Layer (F13 to F24, and One Shot Layer 1,2,3,4)
  25. [0] = LAYOUT_ortho_4x4(
  26. KC_F13, KC_F14, KC_F15, KC_F16,
  27. KC_F17, KC_F18, KC_F19, KC_F20,
  28. KC_F21, KC_F22, KC_F23, KC_F24,
  29. TO(1), OSL(2), OSL(3), LCA(KC_J) //Transparent to let you go between layers
  30. ),
  31. [1] = LAYOUT_ortho_4x4(
  32. LALT(KC_KP_1), LALT(KC_KP_2), LALT(KC_KP_3), LALT(KC_KP_4),
  33. LALT(KC_KP_5), LALT(KC_KP_6), LALT(KC_KP_7), LALT(KC_KP_8),
  34. LALT(KC_KP_9), LALT(KC_A), LALT(KC_B), LALT(KC_C),
  35. TO(2),LALT(KC_D),LALT(KC_E),LALT(KC_F) //Transparent to let you go between layers
  36. ),
  37. //Layer 2 - Shift + Function Key Layer
  38. [2] = LAYOUT_ortho_4x4(
  39. LCA(KC_F1), LCA(KC_F2), LCA(KC_F3), LCA(KC_F4),
  40. LCA(KC_F5), LCA(KC_F6), LCA(KC_F7), LCA(KC_F8),
  41. LCA(KC_F9), LCA(KC_F10),LCA(KC_F11),LCA(KC_F12),
  42. TO(3), LCA(KC_D), LCA(KC_E), LCA(KC_F) //Transparent to let you go between layers
  43. ),
  44. //Layer 3 - Control + Function Key
  45. [3] = LAYOUT_ortho_4x4(
  46. LCA(KC_F13), LCA(KC_F14), LCA(KC_F15), LCA(KC_F16),
  47. LCA(KC_F17), LCA(KC_F18), LCA(KC_F19), LCA(KC_F20),
  48. LCA(KC_F21), LCA(KC_F22),LCA(KC_F23),LCA(KC_F24),
  49. TO(0), LCA(KC_G), LCA(KC_H), LCA(KC_I) //Transparent to let you go between layers
  50. ),
  51. };
  52. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  53. switch (keycode) {
  54. case KC_CCCV: // One key copy/paste
  55. if (record->event.pressed) {
  56. copy_paste_timer = timer_read();
  57. } else {
  58. if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
  59. tap_code16(LCTL(KC_C));
  60. } else { // Tap, paste
  61. tap_code16(LCTL(KC_V));
  62. }
  63. } return true;
  64. case KC_2ENTER:
  65. if (record->event.pressed) {
  66. enter_timer = timer_read();
  67. } else {
  68. if (timer_elapsed(enter_timer) > TAPPING_TERM) { // Hold, shift+enter
  69. tap_code16(LSFT(KC_ENTER));
  70. } else { // Tap, enter
  71. tap_code16(KC_F24);
  72. }
  73. }
  74. return true;
  75. default:
  76. return true;
  77. }
  78. }