process_records.c 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include "curry.h"
  2. uint16_t copy_paste_timer;
  3. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  4. __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
  5. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  6. xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
  7. switch (keycode) {
  8. case KC_MAKE:
  9. if (!record->event.pressed) {
  10. uint8_t temp_mod = mod_config(get_mods());
  11. uint8_t temp_osm = mod_config(get_oneshot_mods());
  12. clear_mods();
  13. clear_oneshot_mods();
  14. send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY);
  15. if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) {
  16. send_string_with_delay_P(PSTR(":flash"), TAP_CODE_DELAY);
  17. }
  18. if ((temp_mod | temp_osm) & MOD_MASK_CTRL) {
  19. send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY);
  20. }
  21. #ifdef RGB_MATRIX_SPLIT_RIGHT
  22. send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes"), TAP_CODE_DELAY);
  23. # ifndef OLED_DRIVER_ENABLE
  24. send_string_with_delay_P(PSTR(" OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY);
  25. # endif
  26. #endif
  27. send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY);
  28. }
  29. break;
  30. case VRSN: // Prints firmware version
  31. if (record->event.pressed) {
  32. send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
  33. }
  34. break;
  35. case KC_CCCV: // One key copy/paste
  36. if (record->event.pressed) {
  37. copy_paste_timer = timer_read();
  38. } else {
  39. if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
  40. register_code(KC_LCTL);
  41. tap_code(KC_C);
  42. unregister_code(KC_LCTL);
  43. } else { // Tap, paste
  44. register_code(KC_LCTL);
  45. tap_code(KC_V);
  46. unregister_code(KC_LCTL);
  47. }
  48. }
  49. break;
  50. #ifdef UNICODE_ENABLE
  51. case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
  52. if (record->event.pressed) {
  53. send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
  54. }
  55. break;
  56. case UC_TABL: // ┬─┬ノ( º _ ºノ)
  57. if (record->event.pressed) {
  58. send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029");
  59. }
  60. break;
  61. case UC_SHRG: // ¯\_(ツ)_/¯
  62. if (record->event.pressed) {
  63. send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
  64. }
  65. break;
  66. case UC_DISA: // ಠ_ಠ
  67. if (record->event.pressed) {
  68. send_unicode_hex_string("0CA0 005F 0CA0");
  69. }
  70. break;
  71. #endif
  72. }
  73. return process_record_keymap(keycode, record) &&
  74. #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
  75. process_record_user_rgb(keycode, record) &&
  76. #endif // RGBLIGHT_ENABLE
  77. process_record_secrets(keycode, record);
  78. }