Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alex-popov-tech/20509c426ff7b3d2764a37cadba04cee to your computer and use it in GitHub Desktop.
Save alex-popov-tech/20509c426ff7b3d2764a37cadba04cee to your computer and use it in GitHub Desktop.
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint16_t my_hash_timer;
switch (keycode) {
case S_ESCAPE:
if(record->event.pressed) {
my_hash_timer = timer_read();
register_code(KC_LSFT); // Change the key to be held here
} else {
unregister_code(KC_LSFT); // Change the key that was held here, too!
if (timer_elapsed(my_hash_timer) < TAPPING_TERM) {
// if command held, send all command+escape sequence AND toggle qwerty/colemak layer
if (get_mods() & (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI))) {
register_code(KC_LGUI);
tap_code(KC_ESC);
unregister_code(KC_LGUI);
layer_invert(_QWERTY);
} else {
// else just send escape
tap_code(KC_ESC);
}
}
}
return false;
}
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment