#include QMK_KEYBOARD_H #include "keycodes.h" uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KEY_F: return 230; case KEY_LOK: case TD_ENTER: return 2 * TAPPING_TERM; default: return TAPPING_TERM; } } static uint32_t key_timer; // timer for last keyboard activity, use // 32bit value and function to make longer // idle time possible static bool left_part; bool keycodes_process_record(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { switch (keycode) { case KC_ESC: case AL_ENT: break; default: // store time of last key release. This is used as a counter in order to // know if we are inside a typing sequence or not. key_timer = timer_read32(); } } left_part = record->event.key.row < (MATRIX_ROWS / 2); switch (keycode) { case KC_ESC: case AL_ENT: if (!record->event.pressed && \ (layer_state_is(LAYER_KEYPAD) || layer_state_is(LAYER_ARROW) )) { // Remove the layer the key is released. layer_clear(); } return true; // If a key where released just before, consider we are typing some text // and do not start the tap tempo. case KEY_F: if (record->event.pressed && left_part && timer_elapsed32(key_timer) < (TAPPING_TERM * 2)) { //register_code(KC_F); tap_code16(KC_F); return false; } return true; case KEY_J: if (record->event.pressed && !left_part && timer_elapsed32(key_timer) < (TAPPING_TERM * 2)) { //register_code(KC_J); tap_code16(KC_J); return false; } return true; // Override the key APP when hold into AltGR + Layer 1 when hold case KEY_APP: if (!record->tap.count && record->event.pressed) { layer_on(LAYER_ARROW); register_code(KC_RIGHT_ALT); return false; } else if (!record->tap.count && !record->event.pressed) { unregister_code(KC_RIGHT_ALT); layer_off(LAYER_ARROW); return false; } case KC_LGUI: if (record->event.pressed) { layer_on(LAYER_ARROW); } else { layer_off(LAYER_ARROW); } return true; default: return true; // Process all other keycodes normally } }