1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include "process_grave_esc.h"
- static bool grave_esc_was_shifted = false;
- bool process_grave_esc(uint16_t keycode, keyrecord_t *record) {
- if (keycode == QK_GRAVE_ESCAPE) {
- const uint8_t mods = get_mods();
- uint8_t shifted = mods & MOD_MASK_SG;
- #ifdef GRAVE_ESC_ALT_OVERRIDE
-
-
- if (mods & MOD_MASK_ALT) {
- shifted = 0;
- }
- #endif
- #ifdef GRAVE_ESC_CTRL_OVERRIDE
-
-
- if (mods & MOD_MASK_CTRL) {
- shifted = 0;
- }
- #endif
- #ifdef GRAVE_ESC_GUI_OVERRIDE
-
- if (mods & MOD_MASK_GUI) {
- shifted = 0;
- }
- #endif
- #ifdef GRAVE_ESC_SHIFT_OVERRIDE
-
- if (mods & MOD_MASK_SHIFT) {
- shifted = 0;
- }
- #endif
- if (record->event.pressed) {
- grave_esc_was_shifted = shifted;
- add_key(shifted ? KC_GRAVE : KC_ESCAPE);
- } else {
- del_key(grave_esc_was_shifted ? KC_GRAVE : KC_ESCAPE);
- }
- send_keyboard_report();
- return false;
- }
-
- return true;
- }
|