manna-harbour_miryoku.c 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Copyright 2022 Manna Harbour
  2. // https://github.com/manna-harbour/miryoku
  3. // This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
  4. #include QMK_KEYBOARD_H
  5. #include "manna-harbour_miryoku.h"
  6. // Additional Features double tap guard
  7. enum {
  8. U_TD_BOOT,
  9. #define MIRYOKU_X(LAYER, STRING) U_TD_U_##LAYER,
  10. MIRYOKU_LAYER_LIST
  11. #undef MIRYOKU_X
  12. };
  13. void u_td_fn_boot(qk_tap_dance_state_t *state, void *user_data) { \
  14. if (state->count == 2) {
  15. reset_keyboard();
  16. }
  17. }
  18. #define MIRYOKU_X(LAYER, STRING) \
  19. void u_td_fn_U_##LAYER(qk_tap_dance_state_t *state, void *user_data) { \
  20. if (state->count == 2) { \
  21. default_layer_set((layer_state_t)1 << U_##LAYER); \
  22. } \
  23. }
  24. MIRYOKU_LAYER_LIST
  25. #undef MIRYOKU_X
  26. qk_tap_dance_action_t tap_dance_actions[] = {
  27. [U_TD_BOOT] = ACTION_TAP_DANCE_FN(u_td_fn_boot),
  28. #define MIRYOKU_X(LAYER, STRING) [U_TD_U_##LAYER] = ACTION_TAP_DANCE_FN(u_td_fn_U_##LAYER),
  29. MIRYOKU_LAYER_LIST
  30. #undef MIRYOKU_X
  31. };
  32. // keymap
  33. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  34. #define MIRYOKU_X(LAYER, STRING) [U_##LAYER] = U_MACRO_VA_ARGS(MIRYOKU_LAYERMAPPING_##LAYER, MIRYOKU_LAYER_##LAYER),
  35. MIRYOKU_LAYER_LIST
  36. #undef MIRYOKU_X
  37. };
  38. // shift functions
  39. const key_override_t capsword_key_override = ko_make_basic(MOD_MASK_SHIFT, CW_TOGG, KC_CAPS);
  40. const key_override_t **key_overrides = (const key_override_t *[]){
  41. &capsword_key_override,
  42. NULL
  43. };
  44. // thumb combos
  45. #if defined (MIRYOKU_KLUDGE_THUMBCOMBOS)
  46. const uint16_t PROGMEM thumbcombos_base_right[] = {LT(U_SYM, KC_ENT), LT(U_NUM, KC_BSPC), COMBO_END};
  47. const uint16_t PROGMEM thumbcombos_base_left[] = {LT(U_NAV, KC_SPC), LT(U_MOUSE, KC_TAB), COMBO_END};
  48. const uint16_t PROGMEM thumbcombos_nav[] = {KC_ENT, KC_BSPC, COMBO_END};
  49. const uint16_t PROGMEM thumbcombos_mouse[] = {KC_BTN2, KC_BTN1, COMBO_END};
  50. const uint16_t PROGMEM thumbcombos_media[] = {KC_MSTP, KC_MPLY, COMBO_END};
  51. const uint16_t PROGMEM thumbcombos_num[] = {KC_0, KC_MINS, COMBO_END};
  52. #if defined (MIRYOKU_LAYERS_FLIP)
  53. const uint16_t PROGMEM thumbcombos_sym[] = {KC_UNDS, KC_LPRN, COMBO_END};
  54. #else
  55. const uint16_t PROGMEM thumbcombos_sym[] = {KC_RPRN, KC_UNDS, COMBO_END};
  56. #endif
  57. const uint16_t PROGMEM thumbcombos_fun[] = {KC_SPC, KC_TAB, COMBO_END};
  58. combo_t key_combos[COMBO_COUNT] = {
  59. COMBO(thumbcombos_base_right, LT(U_FUN, KC_DEL)),
  60. COMBO(thumbcombos_base_left, LT(U_MEDIA, KC_ESC)),
  61. COMBO(thumbcombos_nav, KC_DEL),
  62. COMBO(thumbcombos_mouse, KC_BTN3),
  63. COMBO(thumbcombos_media, KC_MUTE),
  64. COMBO(thumbcombos_num, KC_DOT),
  65. #if defined (MIRYOKU_LAYERS_FLIP)
  66. COMBO(thumbcombos_sym, KC_RPRN),
  67. #else
  68. COMBO(thumbcombos_sym, KC_LPRN),
  69. #endif
  70. COMBO(thumbcombos_fun, KC_APP)
  71. };
  72. #endif