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.

54 lines
1.8 KiB

  1. /* Copyright 2020 Casey Webster <casey@e1337.dev>
  2. *
  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. *
  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. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "keycodes.h"
  17. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  18. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  19. static uint16_t my_colon_timer;
  20. switch (keycode) {
  21. case KC_LCCL:
  22. if (record->event.pressed) {
  23. my_colon_timer = timer_read();
  24. register_code(KC_LCTL);
  25. } else {
  26. unregister_code(KC_LCTL);
  27. if (timer_elapsed(my_colon_timer) < TAPPING_TERM - 50) {
  28. SEND_STRING(":");
  29. }
  30. }
  31. return false;
  32. }
  33. return process_record_keymap(keycode, record);
  34. }
  35. uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
  36. switch (keycode) {
  37. case LSFT_T(KC_T):
  38. case LSFT_T(KC_N):
  39. return TAPPING_TERM - 50;
  40. case LGUI_T(KC_A):
  41. case LALT_T(KC_R):
  42. case LCTL_T(KC_S):
  43. case LCTL_T(KC_E):
  44. case LALT_T(KC_I):
  45. case LGUI_T(KC_O):
  46. return TAPPING_TERM + 150;
  47. default:
  48. return TAPPING_TERM;
  49. }
  50. }