add caps word

This commit is contained in:
Charlotte 🦝 Delenk 2022-10-07 10:14:22 +01:00
parent 05b1374def
commit 15e5712ce6
3 changed files with 29 additions and 0 deletions

View file

@ -23,6 +23,7 @@
//#define SERIAL_USART_PIN_SWAP //#define SERIAL_USART_PIN_SWAP
#define LEADER_NO_TIMEOUT #define LEADER_NO_TIMEOUT
#define DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD
/* /*
* Feature disable options * Feature disable options

View file

@ -1,4 +1,5 @@
#include "neo2.h" #include "neo2.h"
#include "action_util.h"
#include "keycode.h" #include "keycode.h"
#include "quantum.h" #include "quantum.h"
@ -49,4 +50,30 @@ uint32_t keystroke_to_unicode(uint16_t keycode) {
return 0; return 0;
} }
return (uint32_t)keycode_to_char[keycode][getLayer()]; return (uint32_t)keycode_to_char[keycode][getLayer()];
}
bool caps_word_press_user(uint16_t keycode) {
switch (keycode) {
// Keycodes that continue Caps Word, with shift applied.
case KC_A ... KC_Z:
case KC_MINS:
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
return true;
// Keycodes that continue Caps Word, without shifting.
case KC_1 ... KC_0:
case KC_BSPC:
case KC_DEL:
case KC_UNDS:
case KC_LSFT:
case KC_RSFT:
case KC_CAPS:
case KC_NUHS:
case KC_NUBS:
case KC_RALT:
return true;
default:
return getLayer() != 3; // Deactivate Caps Word.
}
} }

View file

@ -17,3 +17,4 @@ CFLAGS += -Wl,--defsym=__unhandled_user_irq=_unhandled_exception
SERIAL_DRIVER = vendor SERIAL_DRIVER = vendor
RAW_ENABLE = yes RAW_ENABLE = yes
CAPS_WORD_ENABLE = yes