Skip to content

Commit

Permalink
turn caps lock off when entering unicode on Linux (partial fix of qmk…
Browse files Browse the repository at this point in the history
  • Loading branch information
spidey3 committed Dec 17, 2020
1 parent c807695 commit e66cd70
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions quantum/process_keycode/process_unicode_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

unicode_config_t unicode_config;
uint8_t unicode_saved_mods;
bool unicode_saved_caps_lock;

#if UNICODE_SELECTED_MODES != -1
static uint8_t selected[] = {UNICODE_SELECTED_MODES};
Expand Down Expand Up @@ -80,11 +81,17 @@ __attribute__((weak)) void unicode_input_start(void) {
unicode_saved_mods = get_mods(); // Save current mods
clear_mods(); // Unregister mods to start from a clean state

unicode_saved_caps_lock = IS_HOST_LED_ON(USB_LED_CAPS_LOCK);

switch (unicode_config.input_mode) {
case UC_MAC:
register_code(UNICODE_KEY_MAC);
break;
case UC_LNX:
if (unicode_saved_caps_lock) {
tap_code(KC_CAPS);
wait_ms(UNICODE_TYPE_DELAY);
}
tap_code16(UNICODE_KEY_LNX);
break;
case UC_WIN:
Expand All @@ -107,6 +114,10 @@ __attribute__((weak)) void unicode_input_finish(void) {
break;
case UC_LNX:
tap_code(KC_SPC);
if (unicode_saved_caps_lock) {
wait_ms(UNICODE_TYPE_DELAY);
tap_code(KC_CAPS);
}
break;
case UC_WIN:
unregister_code(KC_LALT);
Expand All @@ -125,6 +136,12 @@ __attribute__((weak)) void unicode_input_cancel(void) {
unregister_code(UNICODE_KEY_MAC);
break;
case UC_LNX:
if (unicode_saved_caps_lock) {
wait_ms(UNICODE_TYPE_DELAY);
tap_code(KC_CAPS);
}
tap_code(KC_ESC);
break;
case UC_WINC:
tap_code(KC_ESC);
break;
Expand Down

0 comments on commit e66cd70

Please sign in to comment.