gourdo1.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 SWAP_L SGUI(KC_LEFT) // Swap application to left display
  36. #define SWAP_R SGUI(KC_RGHT) // Swap application to right display
  37. // KEYCODES
  38. enum custom_user_keycodes {
  39. KC_00 = SAFE_RANGE,
  40. ENCFUNC, // Encoder function
  41. CAPSNUM, // Capslock key function
  42. LEFTOFENC, // Key to the left of the encoder (i.e. F13)
  43. BELOWENC, // Key below encoder
  44. PRNCONF, // Print verbose statuses of all user_config toggles
  45. WINLOCK, // Toggles Windows key on and off
  46. RGB_TOI, // Timeout idle time up
  47. RGB_TOD, // Timeout idle time down
  48. RGB_NITE, // Disables RGB backlighting effects but allows RGB indicators to still work
  49. TG_CAPS, // Toggles RGB highlighting of alphas during capslock
  50. TG_PAD, // Toggles RGB highlighting of keys on numpad+mousekeys layer
  51. TG_TDCAP, // Toggles double tap shift (tapdance) for CapsLock
  52. TG_DEL, // Swaps DEL and HOME key locations
  53. TG_ENC, // Toggle Encoder functionality
  54. TG_ESC, // Toggle ESC tapdance for _BASE layer
  55. TG_INS, // Toggle location of INS
  56. TG_SPCMOD, // Toggle disabling of modded-SPACE functions
  57. YAHOO, // yahoo.com
  58. OUTLOOK, // outlook.com
  59. GMAIL, // gmail.com
  60. HOTMAIL, // hotmail.com
  61. DOTCOM, // .com
  62. EMO_SHRUG, // `\_("/)_/`
  63. EMO_CONFUSE, // (*_*)
  64. EMO_SAD, // :'-(
  65. EMO_NERVOUS, // (~_~;)
  66. EMO_JOY, // (^o^)
  67. EMO_TEARS, // (T_T)
  68. KC_TSTOG, // Tab Scroll Toggle
  69. NEW_SAFE_RANGE // New safe range for keymap level custom keycodes
  70. };
  71. // Tap Dance Definitions
  72. enum custom_tapdance {
  73. TD_LSFT_CAPS_WIN,
  74. };
  75. // Set up boolean variables to track user customizable configuration options
  76. typedef union {
  77. uint32_t raw;
  78. struct {
  79. bool rgb_hilite_caps :1;
  80. bool rgb_hilite_numpad :1;
  81. bool esc_double_tap_to_baselyr :1;
  82. bool del_right_home_top :1;
  83. bool double_tap_shift_for_capslock :1;
  84. bool encoder_press_mute_or_media :1;
  85. bool ins_on_shft_bkspc_or_del :1;
  86. bool disable_space_mods :1;
  87. };
  88. } user_config_t;
  89. user_config_t user_config;
  90. #define LSFTCAPSWIN TD(TD_LSFT_CAPS_WIN)
  91. // ENCODER ACTIONS
  92. #ifdef ENCODER_ENABLE
  93. void encoder_action_volume(bool clockwise);
  94. void encoder_action_mediatrack(bool clockwise);
  95. void encoder_action_navword(bool clockwise);
  96. void encoder_action_navpage(bool clockwise);
  97. uint8_t get_selected_layer(void);
  98. void encoder_action_layerchange(bool clockwise);
  99. #if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE)
  100. void encoder_action_rgb_speed(bool clockwise);
  101. void encoder_action_rgb_hue(bool clockwise);
  102. void encoder_action_rgb_saturation(bool clockwise);
  103. void encoder_action_rgb_brightness(bool clockwise);
  104. void encoder_action_rgb_mode(bool clockwise);
  105. #endif // RGB_MATRIX_ENABLE / RGBLIGHT_ENABLE
  106. #ifdef ALTTAB_SCROLL_ENABLE
  107. void encoder_action_alttabscroll(bool clockwise);
  108. void encoder_toggle_alttabscroll(void);
  109. void encoder_tick_alttabscroll(void);
  110. #endif // ALTTAB_SCROLL_ENABLE
  111. #endif // ENCODER_ENABLE
  112. #ifdef RGB_MATRIX_ENABLE
  113. void activate_rgb_nightmode(bool turn_on);
  114. bool get_rgb_nightmode(void);
  115. #endif
  116. // IDLE TIMEOUTS
  117. #ifdef IDLE_TIMEOUT_ENABLE
  118. #define TIMEOUT_THRESHOLD_DEFAULT 15 // default timeout minutes
  119. #define TIMEOUT_THRESHOLD_MAX 140 // upper limits (2 hours and 10 minutes -- no rgb indicators above this value)
  120. //prototype functions
  121. uint16_t get_timeout_threshold(void);
  122. void timeout_reset_timer(void);
  123. void timeout_update_threshold(bool increase);
  124. void timeout_tick_timer(void);
  125. #endif //IDLE_TIMEOUT_ENABLE
  126. // OTHER FUNCTION PROTOTYPE
  127. void activate_numlock(bool turn_on);