Use esc as a lock-ending key

This commit is contained in:
bluepython508
2024-05-19 21:12:32 +01:00
parent c8704dbe6b
commit a042a8266a

View File

@@ -134,8 +134,8 @@ bool is_oneshot_ignored_key(uint16_t keycode) {
} }
} }
bool is_oneshot_cancel_key(uint16_t keycode) { bool is_oneshot_cancel_key(uint16_t keycode, oneshot_mode_t mode) {
return keycode == KC_NO; return keycode == KC_NO || (keycode == KC_ESCAPE && mode == os_locked);
} }
// Based on // Based on
@@ -183,7 +183,7 @@ void update_oneshot(oneshot_state_t *state, uint16_t keycode, keyrecord_t *recor
} }
} else { } else {
if (record->event.pressed) { if (record->event.pressed) {
if (is_oneshot_cancel_key(keycode) && state->mode != os_up_unqueued) { if (is_oneshot_cancel_key(keycode, state->mode) && state->mode != os_up_unqueued) {
// Cancel oneshot on designated cancel keydown. // Cancel oneshot on designated cancel keydown.
state->mode = os_up_unqueued; state->mode = os_up_unqueued;
unregister_code(state->mod); unregister_code(state->mod);