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.

152 lines
4.2 KiB

  1. // based on drashna's but I think at this point it's a new axe
  2. #include QMK_KEYBOARD_H
  3. #include "milestogo.h"
  4. #include <print.h>
  5. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  6. bool move_is_on = false; // track if we are in _MOV layer
  7. bool sym_is_on = false; // track if we are in _SYM layer
  8. // Defines actions for global custom keycodes
  9. // Then runs the _keymap's record handier if not processed here
  10. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  11. // static uint16_t spcmov_timer; // timer for spcmov key
  12. #ifdef USE_BABBLEPASTE
  13. if (keycode > BABBLE_START && keycode < BABBLE_END_RANGE) {
  14. if (record->event.pressed) {
  15. babblePaste(keycode, 1);
  16. } else {
  17. babblePaste(keycode, 0);
  18. }
  19. }
  20. #endif
  21. switch (keycode) {
  22. case KC_QWERTY:
  23. if (record->event.pressed) {
  24. layer_off(_CDH);
  25. default_layer_set(_QWERTY);
  26. }
  27. break;
  28. case KC_CDH:
  29. if (record->event.pressed) {
  30. layer_on(_CDH);
  31. default_layer_set(_CDH);
  32. }
  33. break;
  34. case TMUX: // ctl-B
  35. if (record->event.pressed) {
  36. tap_code16(C(KC_B));
  37. }
  38. break;
  39. /* Colemak mod-dh moves the D key to the qwerty V position
  40. This hack makes apple-V_position do what I mean */
  41. case DHPASTE:
  42. if (get_mods() & MOD_BIT(KC_LGUI)) {
  43. if (record->event.pressed) {
  44. clear_keyboard_but_mods();
  45. register_code(KC_V);
  46. } else {
  47. unregister_code(KC_V);
  48. }
  49. } else {
  50. if (record->event.pressed) {
  51. register_code(KC_D);
  52. } else {
  53. unregister_code(KC_D);
  54. }
  55. }
  56. return false;
  57. break;
  58. default:
  59. return true;
  60. }
  61. // normal keycode
  62. return process_record_keymap(keycode, record);
  63. }
  64. void babble_modeswitch_user(uint8_t mode) {
  65. #ifdef USE_BABLPASTE
  66. extern uint8_t babble_mode; // still using global. why?
  67. # ifdef BABL_WINDOWS
  68. if (babble_mode == BABL_WINDOWS_MODE) {
  69. if (BABL_LED_INDEX > 0) {
  70. rgblight_setrgb_at(RGBLIGHT_COLOR_MS, BABL_LED_INDEX);
  71. } else {
  72. rgblight_setrgb(RGBLIGHT_COLOR_MS);
  73. }
  74. }
  75. # endif
  76. # ifdef BABL_READMUX
  77. if (babble_mode == BABL_READMUX_MODE) {
  78. if (BABL_LED_INDEX > 0) {
  79. rgblight_setrgb_at(RGBLIGHT_COLOR_READMUX, BABL_LED_INDEX);
  80. } else {
  81. rgblight_setrgb(RGBLIGHT_COLOR_READMUX);
  82. }
  83. }
  84. # endif
  85. # ifdef BABL_MAC
  86. if (babble_mode == BABL_MAC_MODE) {
  87. if (BABL_LED_INDEX > 0) {
  88. rgblight_setrgb_at(RGBLIGHT_COLOR_MAC, BABL_LED_INDEX);
  89. } else {
  90. rgblight_setrgb(RGBLIGHT_COLOR_MAC);
  91. }
  92. }
  93. # endif
  94. # ifdef BABL_VI
  95. if (babble_mode == BABL_VI_MODE) {
  96. if (BABL_LED_INDEX > 0) {
  97. rgblight_setrgb_at(RGBLIGHT_COLOR_VI, BABL_LED_INDEX);
  98. } else {
  99. rgblight_setrgb(RGBLIGHT_COLOR_VI);
  100. }
  101. }
  102. # endif
  103. # ifdef BABL_EMACS
  104. if (babble_mode == BABL_EMACS_MODE) {
  105. if (BABL_LED_INDEX > 0) {
  106. rgblight_setrgb_at(RGBLIGHT_COLOR_EMACS, BABL_LED_INDEX);
  107. } else {
  108. rgblight_setrgb(RGBLIGHT_COLOR_EMACS);
  109. }
  110. }
  111. # endif
  112. # ifdef BABL_CHROMEOS
  113. if (babble_mode == BABL_CHROMEOS_MODE) {
  114. if (BABL_LED_INDEX > 0) {
  115. rgblight_setrgb_at(RGBLIGHT_COLOR_CHROMEOS, BABL_LED_INDEX);
  116. } else {
  117. rgblight_setrgb(RGBLIGHT_COLOR_CHROMEOS);
  118. }
  119. }
  120. # endif
  121. # ifdef BABL_LINUX
  122. if (babble_mode == BABL_LINUX_MODE) {
  123. if (BABL_LED_INDEX > 0) {
  124. rgblight_setrgb_at(RGBLIGHT_COLOR_LINUX, BABL_LED_INDEX);
  125. } else {
  126. rgblight_setrgb(RGBLIGHT_COLOR_LINUX);
  127. }
  128. }
  129. # endif
  130. #endif // bablepaste
  131. }
  132. // we always return true here, so that each keyboard can use it's own
  133. // led_update_kb() function
  134. bool led_update_user(led_t led_state ) {
  135. return true;
  136. }