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.

156 lines
5.4 KiB

  1. /* Copyright 2021 Jonavin Eng @Jonavin
  2. Copyright 2022 gourdo1 <gourdo1@outlook.com>
  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. #pragma once
  15. // DEFINE MACROS
  16. #define ARRAYSIZE(arr) sizeof(arr) / sizeof(arr[0])
  17. // LAYERS -- Note: to avoid compile problems, make sure total layers matches DYNAMIC_KEYMAP_LAYER_COUNT defined in config.h (where _COLEMAK layer is defined)
  18. enum custom_user_layers {
  19. _BASE,
  20. _FN1,
  21. _NUMPADMOUSE,
  22. _MOUSEKEY,
  23. #ifdef GAME_ENABLE
  24. _GAME
  25. #endif //GAME_ENABLE
  26. };
  27. #define KC_CAD LALT(LCTL(KC_DEL))
  28. #define LOCKPC LGUI(KC_L)
  29. #define KC_AF4 LALT(KC_F4)
  30. #define KC_TASK LCTL(LSFT(KC_ESC))
  31. #define CT_PGUP RCTL(KC_PGUP)
  32. #define CT_PGDN RCTL(KC_PGDN)
  33. #define CT_HOME RCTL(KC_HOME)
  34. #define CT_END RCTL(KC_END)
  35. #define KC_SFTUP RSFT_T(KC_UP) // Shift when held, Up arrow when tapped
  36. #define KC_RAISESPC LT(_MOUSEKEY, KC_SPC) // _MOUSEKEY layer mod when held, space when tapped
  37. #define KC_LOWERSPC LT(_NUMPADMOUSE, KC_SPC) // _NUMPAD-MOUSE layer mod when held, space when tapped
  38. #define KC_SHIFTSPC LSFT(KC_SPC)
  39. #define SWAP_L SGUI(KC_LEFT) // Swap application to left display
  40. #define SWAP_R SGUI(KC_RGHT) // Swap application to right display
  41. // KEYCODES
  42. enum custom_user_keycodes {
  43. KC_00 = SAFE_RANGE,
  44. ENCFUNC, // Encoder function
  45. CAPSNUM, // Capslock key function
  46. LEFTOFENC, // Key to the left of the encoder (i.e. F13)
  47. BELOWENC, // Key below encoder
  48. PRNCONF, // Print verbose statuses of all user_config toggles
  49. WINLOCK, // Toggles Windows key on and off
  50. RGB_TOI, // Timeout idle time up
  51. RGB_TOD, // Timeout idle time down
  52. RGB_NITE, // Disables RGB backlighting effects but allows RGB indicators to still work
  53. TG_CAPS, // Toggles RGB highlighting of alphas during capslock
  54. TG_PAD, // Toggles RGB highlighting of keys on numpad+mousekeys layer
  55. TG_TDCAP, // Toggles double tap shift (tapdance) for CapsLock
  56. TG_DEL, // Swaps DEL and HOME key locations
  57. TG_ENC, // Toggle Encoder functionality
  58. TG_ESC, // Toggle ESC tapdance for _BASE layer
  59. TG_INS, // Toggle location of INS
  60. TG_CTLSPC, // Toggle CTRL-SPACE disable function
  61. YAHOO, // yahoo.com
  62. OUTLOOK, // outlook.com
  63. GMAIL, // gmail.com
  64. HOTMAIL, // hotmail.com
  65. DOTCOM, // .com
  66. EMO_SHRUG, // `\_("/)_/`
  67. EMO_CONFUSE, // (*_*)
  68. EMO_SAD, // :'-(
  69. EMO_NERVOUS, // (~_~;)
  70. EMO_JOY, // (^o^)
  71. EMO_TEARS, // (T_T)
  72. KC_TSTOG, // Tab Scroll Toggle
  73. NEW_SAFE_RANGE // New safe range for keymap level custom keycodes
  74. };
  75. // Tap Dance Definitions
  76. enum custom_tapdance {
  77. TD_LSFT_CAPS_WIN,
  78. };
  79. // Set up boolean variables to track user customizable configuration options
  80. typedef union {
  81. uint32_t raw;
  82. struct {
  83. bool rgb_hilite_caps :1;
  84. bool rgb_hilite_numpad :1;
  85. bool esc_double_tap_to_baselyr :1;
  86. bool del_right_home_top :1;
  87. bool double_tap_shift_for_capslock :1;
  88. bool encoder_press_mute_or_media :1;
  89. bool ins_on_shft_bkspc_or_del :1;
  90. bool disable_ctrl_space :1;
  91. };
  92. } user_config_t;
  93. user_config_t user_config;
  94. #define LSFTCAPSWIN TD(TD_LSFT_CAPS_WIN)
  95. // ENCODER ACTIONS
  96. #ifdef ENCODER_ENABLE
  97. void encoder_action_volume(bool clockwise);
  98. void encoder_action_mediatrack(bool clockwise);
  99. void encoder_action_navword(bool clockwise);
  100. void encoder_action_navpage(bool clockwise);
  101. uint8_t get_selected_layer(void);
  102. void encoder_action_layerchange(bool clockwise);
  103. #if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE)
  104. void encoder_action_rgb_speed(bool clockwise);
  105. void encoder_action_rgb_hue(bool clockwise);
  106. void encoder_action_rgb_saturation(bool clockwise);
  107. void encoder_action_rgb_brightness(bool clockwise);
  108. void encoder_action_rgb_mode(bool clockwise);
  109. #endif // RGB_MATRIX_ENABLE / RGBLIGHT_ENABLE
  110. #ifdef ALTTAB_SCROLL_ENABLE
  111. void encoder_action_alttabscroll(bool clockwise);
  112. void encoder_toggle_alttabscroll(void);
  113. void encoder_tick_alttabscroll(void);
  114. #endif // ALTTAB_SCROLL_ENABLE
  115. #endif // ENCODER_ENABLE
  116. #ifdef RGB_MATRIX_ENABLE
  117. void activate_rgb_nightmode(bool turn_on);
  118. bool get_rgb_nightmode(void);
  119. #endif
  120. // IDLE TIMEOUTS
  121. #ifdef IDLE_TIMEOUT_ENABLE
  122. #define TIMEOUT_THRESHOLD_DEFAULT 15 // default timeout minutes
  123. #define TIMEOUT_THRESHOLD_MAX 140 // upper limits (2 hours and 10 minutes -- no rgb indicators above this value)
  124. //prototype functions
  125. uint16_t get_timeout_threshold(void);
  126. void timeout_reset_timer(void);
  127. void timeout_update_threshold(bool increase);
  128. void timeout_tick_timer(void);
  129. #endif //IDLE_TIMEOUT_ENABLE
  130. // OTHER FUNCTION PROTOTYPE
  131. void activate_numlock(bool turn_on);