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.

118 lines
4.2 KiB

  1. /*
  2. Copyright 2020 rupa <rupa@lrrr.us> @rupa
  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 "rupa.h"
  15. uint16_t processed_keycode;
  16. __attribute__((weak))
  17. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  18. return true;
  19. }
  20. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  21. if (record->event.pressed) {
  22. processed_keycode = keycode;
  23. // mask out mod taps
  24. if (
  25. (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
  26. (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)
  27. ) {
  28. processed_keycode &= 0xFF;
  29. }
  30. bool is_shifted = (get_mods() | get_oneshot_mods() | get_weak_mods()) & MOD_MASK_SHIFT;
  31. switch(processed_keycode) {
  32. case VRSN:
  33. send_string_with_delay_P(PSTR(
  34. "# " QMK_KEYBOARD "/" QMK_KEYMAP ":" QMK_VERSION " " QMK_BUILDDATE "\n"
  35. ), TAP_CODE_DELAY);
  36. return false;
  37. case BUGS:
  38. return u_xp(is_shifted, "ᙙᙖ", "");
  39. case CATS:
  40. return u_xp(is_shifted, "ⓛ ᆽ ⓛ ", "ㅇㅅㅇ");
  41. case DANCE:
  42. return u_x(dance(is_shifted));
  43. case DICE:
  44. return u_x(d6());
  45. case DOMO:
  46. return u_xp(is_shifted, "(シ_ _)", "m(_ _)m");
  47. case FART:
  48. return u_x("⊥ʶ∀Ⅎ");
  49. case FLIP:
  50. return u_x(flip(is_shifted));
  51. case HUGS:
  52. return u_xp(is_shifted, "(づ ̄ ³ ̄)", "()");
  53. case JOY:
  54. return u_x(joy(is_shifted));
  55. case RNDM:
  56. return false;
  57. case KISS:
  58. return u_xp(is_shifted, "꒒ ০ ⌵ ୧ ♡", "( ˘ ³˘)");
  59. case LOD:
  60. return u_xp(is_shifted, "( ͡ಠ ʖ̯ ͡ಠ)", "_ಠ");
  61. case MUSIC:
  62. return u_xp(is_shifted, "(˳˘ ɜ˘)˳ ", "(´)");
  63. case RUPA:
  64. return u_xp(is_shifted, "Śrīrūpa", "rūpa");
  65. case SHRUG:
  66. return u_xp(is_shifted, "⋌ ༼ •̀ ⌂ •́ ༽⋋", "¯\\_(ツ)_/¯");
  67. case TADA:
  68. return u_xp(is_shifted, "☆ *・゜゚・*(^O^)/*・゜゚・*☆", "\\(゜ロ\\)Ξ(//ロ゜)//");
  69. case WAT:
  70. return u_xp(is_shifted, "༼ ຶཽཀ ຶཽ༽", "ヽ༼⊙_⊙༽ノ");
  71. case YUNO:
  72. return u_xp(is_shifted, "o(^^o)", "щ(щ)");
  73. case ZALGO:
  74. set_combined_mode(CM_ZALGO);
  75. break;
  76. case ZZZZZ:
  77. cycle_combined_mode();
  78. break;
  79. #if defined(UNICODE_SCRIPT_MODE_ENABLE)
  80. // script modes
  81. case U_FRACT:
  82. return set_script_mode(F_FRACT);
  83. case U_ITALI:
  84. return set_script_mode(F_ITALI);
  85. case U_MONOS:
  86. return set_script_mode(F_MONOS);
  87. case U_NORML:
  88. return set_script_mode(F_NORML);
  89. case U_SANSI:
  90. return set_script_mode(F_SANSI);
  91. case U_SANSN:
  92. return set_script_mode(F_SANSN);
  93. case U_SCRPT:
  94. return set_script_mode(F_SCRPT);
  95. default:
  96. if (get_script_mode() != NULL) {
  97. return script_mode_translate(is_shifted, processed_keycode);
  98. }
  99. if (combined_mode != CM_NULL && combined_text(processed_keycode)) {
  100. return false;
  101. }
  102. #endif
  103. }
  104. }
  105. return process_record_keymap(keycode, record);
  106. }