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.

139 lines
4.7 KiB

  1. /**
  2. * Copyright (C) 2021 Jerrell, Jacob <@jjerrell>
  3. *
  4. * This file is part of qmk_firmware.
  5. *
  6. * qmk_firmware is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * qmk_firmware is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with qmk_firmware. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include "jjerrell.h"
  20. float game_song[][2] = SONG(TO_BOLDLY_GO);
  21. float work_song[][2] = SONG(MARIO_GAMEOVER);
  22. float doom_song[][2] = SONG(E1M1_DOOM);
  23. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  24. static uint16_t key_timer;
  25. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  26. if (process_record_keymap(keycode, record)) {
  27. static uint8_t mods = 0;
  28. // static uint8_t layer = 0;
  29. mods = get_mods();
  30. switch (keycode) {
  31. case KC_QWERTY:
  32. if (record->event.pressed) {
  33. set_single_persistent_default_layer(_QWERTY);
  34. }
  35. return false;
  36. break;
  37. case KC_WORKMAN:
  38. if (record->event.pressed) {
  39. set_single_persistent_default_layer(_WORKMAN);
  40. }
  41. return false;
  42. break;
  43. case KC_CCCV:
  44. if (record->event.pressed) {
  45. key_timer = timer_read();
  46. } else {
  47. clear_mods();
  48. if (timer_elapsed(key_timer) > TAPPING_TERM) { // Hold, copy
  49. tap_code16(G(KC_C));
  50. } else if (mods & MOD_MASK_SHIFT) {
  51. // Tap w/ shift held, open [Paste App](https://pasteapp.io) (no affiliation)
  52. // Shift + Command(GUI) + V
  53. tap_code16(S(G(KC_V)));
  54. } else { // Regular tap, do paste
  55. tap_code16(G(KC_V));
  56. }
  57. set_mods(mods);
  58. }
  59. return false;
  60. break;
  61. case KC_ARROW:
  62. if (record->event.pressed) {
  63. clear_mods();
  64. if (mods & MOD_MASK_SHIFT) {
  65. SEND_STRING("=>");
  66. } else {
  67. SEND_STRING("->");
  68. }
  69. set_mods(mods);
  70. }
  71. return false;
  72. break;
  73. case KC_MAKE:
  74. if (!record->event.pressed) {
  75. #ifndef MAKE_BOOTLOADER
  76. uint8_t temp_mod = mod_config(get_mods());
  77. uint8_t temp_osm = mod_config(get_oneshot_mods());
  78. clear_mods();
  79. clear_oneshot_mods();
  80. #endif
  81. send_string_with_delay_P(PSTR("qmk"), TAP_CODE_DELAY);
  82. #ifndef MAKE_BOOTLOADER
  83. if ((temp_mod | temp_osm) & MOD_MASK_SHIFT)
  84. #endif
  85. {
  86. send_string_with_delay_P(PSTR(" flash "), TAP_CODE_DELAY);
  87. #ifndef MAKE_BOOTLOADER
  88. } else {
  89. send_string_with_delay_P(PSTR(" compile "), TAP_CODE_DELAY);
  90. #endif
  91. }
  92. send_string_with_delay_P(PSTR("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP), TAP_CODE_DELAY);
  93. send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY);
  94. }
  95. return false;
  96. break;
  97. case KC_VRSN:
  98. if (!record->event.pressed) {
  99. send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY);
  100. }
  101. return false;
  102. break;
  103. case KC_GAME:
  104. if (record->event.pressed) {
  105. key_timer = timer_read();
  106. } else {
  107. if (IS_LAYER_OFF(_GAME)) {
  108. if (timer_elapsed(key_timer) > TAPPING_TERM) {
  109. layer_move(_GAME);
  110. #ifdef AUDIO_ENABLE
  111. PLAY_SONG(game_song);
  112. #endif
  113. }
  114. break;
  115. // todo: cycle game layers
  116. // } else if (mods & MOD_MASK_SHIFT) {
  117. // #ifdef AUDIO_ENABLE
  118. // PLAY_SONG(doom_song);
  119. // #endif
  120. // break;
  121. } else {
  122. layer_move(_WORKMAN);
  123. #ifdef AUDIO_ENABLE
  124. PLAY_SONG(work_song);
  125. #endif
  126. break;
  127. }
  128. }
  129. return false;
  130. break;
  131. }
  132. }
  133. return true;
  134. }