Skip to content

Instantly share code, notes, and snippets.

@drashna
Last active October 1, 2018 06:58
Show Gist options
  • Save drashna/f83edc0ad334b3ff808023d64e48a316 to your computer and use it in GitHub Desktop.
Save drashna/f83edc0ad334b3ff808023d64e48a316 to your computer and use it in GitHub Desktop.
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