Skip to content

Instantly share code, notes, and snippets.

@d-yoshi
Last active July 28, 2017 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d-yoshi/18d02e337b80b2d7136343d495e944af to your computer and use it in GitHub Desktop.
Save d-yoshi/18d02e337b80b2d7136343d495e944af to your computer and use it in GitHub Desktop.
LT(layer, kc) のkcが入力されたときのみ何か処理をしたい場合、keydown時のlayerを覚えておいてkeyup時に変わっていないか見れば良い。
uint32_t tmp_layer_state = 0;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LT(SYMB, KC_LANG2):
if (record->event.pressed) {
tmp_layer_state = layer_state;
} else if (tmp_layer_state == layer_state) {
register_code(KC_F16);
unregister_code(KC_F16);
}
break;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment