aboutsummaryrefslogtreecommitdiff
path: root/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-27 09:21:15 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-27 09:21:15 +0100
commit93ed6753590d1b996beb95b35980cb613f4447e5 (patch)
tree2f2d5bb2241c77353606868f1a874a9fdc3526ef /qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
parent60b834c340cc6d5508eec31c2368bf5cf01e72a0 (diff)
Use single tap for CTRL keysHEADmaster
Removed old code
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c')
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
index e2fb583..76b6b91 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c
@@ -3,12 +3,39 @@
bool keycodes_process_record(uint16_t keycode, keyrecord_t *record) {
+ static bool kc_lgui = false;
+ static bool kc_ralt = false;
switch (keycode) {
case KC_ESC:
+ /* By default, send the ESC code to the host.
+ * This code will be muted if there is a specific state to remove firts.
+
+ * The keys L_GUI and R_ALT activate a layer automatically, but can be
+ * used in a combo with the ESC key, I do not want to ignore the key press
+ * in this case.
+ */
+ bool handle_key = true;
+ if (get_oneshot_mods()) {
+ clear_oneshot_mods();
+ handle_key = false;
+ }
+ if ( (! kc_ralt) \
+ && (! kc_lgui) \
+ && (layer_state_is(LAYER_KEYPAD) || layer_state_is(LAYER_ARROW) )) {
+ // Remove the layer the key is released.
+ layer_clear();
+ handle_key = false;
+ }
+ if (host_keyboard_led_state().caps_lock) {
+ tap_code16(KC_CAPS_LOCK);
+ handle_key = false;
+ }
+ return handle_key;
case AL_ENT:
- if (!record->event.pressed && \
- (layer_state_is(LAYER_KEYPAD) || layer_state_is(LAYER_ARROW) )) {
+ if (!record->event.pressed \
+ && (! kc_lgui) \
+ && (layer_state_is(LAYER_KEYPAD) || layer_state_is(LAYER_ARROW) )) {
// Remove the layer the key is released.
layer_clear();
}
@@ -17,16 +44,20 @@ bool keycodes_process_record(uint16_t keycode, keyrecord_t *record) {
// 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);
+ kc_ralt = record->event.pressed;
register_code(KC_RIGHT_ALT);
+ layer_on(LAYER_ARROW);
return false;
} else if (!record->tap.count && !record->event.pressed) {
+ kc_ralt = record->event.pressed;
unregister_code(KC_RIGHT_ALT);
layer_off(LAYER_ARROW);
return false;
}
+ return true;
case KC_LGUI:
+ kc_lgui = record->event.pressed;
if (record->event.pressed) {
layer_on(LAYER_ARROW);
}