Last active
October 1, 2018 06:58
-
-
Save drashna/f83edc0ad334b3ff808023d64e48a316 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum custom_keycodes { | |
MY_CUSTOM_MACRO = SAFE_RANGE | |
}; | |
//... | |
bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |
switch(keycode) { | |
case MY_CUSTOM_MACRO: | |
if (record->event.pressed) { | |
key_timer = timer_read(); // start the timer if the event is a keydown/press | |
} | |
else { // read the timer and send the appropriate keycode | |
if (timer_elapsed(key_timer) < TAPPING_TERM) { | |
SEND_STRING(SS_LSFT(X_EQUAL))); | |
return false; | |
} | |
else { | |
SEND_STRING(SS_TAP(X_CTRL)); | |
return false; | |
} | |
} | |
} | |
return true; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment