blob: e2fb583921f106bcee55b9c2931cf102ad9a1e0e (
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
|
#include QMK_KEYBOARD_H
#include "keycodes.h"
bool keycodes_process_record(uint16_t keycode, keyrecord_t *record) {
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;
// 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
}
}
|