From 15e5712ce6ab7cab5d314182ea0794049c5ceb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Fri, 7 Oct 2022 10:14:22 +0100 Subject: [PATCH] add caps word --- keyboards/rkb1/config.h | 1 + keyboards/rkb1/keymaps/simple/neo2.c | 27 +++++++++++++++++++++++++++ keyboards/rkb1/rules.mk | 1 + 3 files changed, 29 insertions(+) diff --git a/keyboards/rkb1/config.h b/keyboards/rkb1/config.h index a4496174bf..5e3d2bf47d 100644 --- a/keyboards/rkb1/config.h +++ b/keyboards/rkb1/config.h @@ -23,6 +23,7 @@ //#define SERIAL_USART_PIN_SWAP #define LEADER_NO_TIMEOUT +#define DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD /* * Feature disable options diff --git a/keyboards/rkb1/keymaps/simple/neo2.c b/keyboards/rkb1/keymaps/simple/neo2.c index 9551321950..a7d7638d73 100644 --- a/keyboards/rkb1/keymaps/simple/neo2.c +++ b/keyboards/rkb1/keymaps/simple/neo2.c @@ -1,4 +1,5 @@ #include "neo2.h" +#include "action_util.h" #include "keycode.h" #include "quantum.h" @@ -49,4 +50,30 @@ uint32_t keystroke_to_unicode(uint16_t keycode) { return 0; } 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. + } } \ No newline at end of file diff --git a/keyboards/rkb1/rules.mk b/keyboards/rkb1/rules.mk index cdf35b9b44..927f8518c0 100644 --- a/keyboards/rkb1/rules.mk +++ b/keyboards/rkb1/rules.mk @@ -17,3 +17,4 @@ CFLAGS += -Wl,--defsym=__unhandled_user_irq=_unhandled_exception SERIAL_DRIVER = vendor RAW_ENABLE = yes +CAPS_WORD_ENABLE = yes