blob: 4fba73c6d68b11091caa576264c846756455df48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#include QMK_KEYBOARD_H
#include "keymap_bepo.h"
#include "keycodes.h"
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KEY_E:
return 230;
case KEY_W:
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
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();
}
}
switch (keycode) {
case KC_ESC:
case AL_ENT:
if (layer_state_is(LAYER_SYMBOLS) && !record->event.pressed) {
// 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 not starting a new sequence
case KEY_E:
if (record->event.pressed && timer_elapsed32(key_timer) < TAPPING_TERM) {
if (is_caps_word_on()) {
add_oneshot_mods(MOD_MASK_SHIFT);
}
register_code(BP_E);
return false;
}
return true;
case KEY_T:
if (record->event.pressed && timer_elapsed32(key_timer) < TAPPING_TERM) {
if (is_caps_word_on()) {
add_oneshot_mods(MOD_MASK_SHIFT);
}
register_code(BP_T);
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(1);
register_code(KC_RIGHT_ALT);
return false;
} else if (!record->tap.count && !record->event.pressed) {
unregister_code(KC_RIGHT_ALT);
layer_off(1);
return false;
}
case KC_LGUI:
if (record->event.pressed) {
layer_on(1);
}
else {
layer_off(1);
}
return true;
default:
return true; // Process all other keycodes normally
}
}
|