Skip to content

Instantly share code, notes, and snippets.

@arkag
Created August 28, 2018 18:04
Show Gist options
  • Select an option

  • Save arkag/52d11f9a98f6c2ce2efa93a87bace9d0 to your computer and use it in GitHub Desktop.

Select an option

Save arkag/52d11f9a98f6c2ce2efa93a87bace9d0 to your computer and use it in GitHub Desktop.
process_record_keymap function
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TOG_OS:
is_mac = ! is_mac;
break;
case M_GUI_CTRL:
is_mac ? tap_key(KC_CTRL) : tap_key(KC_GUI);
break;
case M_CTRL_GUI:
is_mac ? tap_key(KC_GUI) : tap_key(KC_CTRL);
break;
case KC_ESC:
if (!record->event.pressed) {
if ((get_oneshot_mods ()) && !has_oneshot_mods_timed_out ()) {
clear_oneshot_mods ();
} else {
tap_key(KC_ESC);
}
}
default:
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment