summaryrefslogtreecommitdiff
path: root/users/drashna/drashna.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/drashna.c')
-rw-r--r--users/drashna/drashna.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 283e82d13d..259810c70f 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -117,7 +117,7 @@ void do_scan(void) {
uint16_t scan_timer = 0;
-void matrix_scan_i2c(void) {
+void housekeeping_task_i2c_scanner(void) {
if (timer_elapsed(scan_timer) > 5000) {
do_scan();
scan_timer = timer_read();
@@ -139,7 +139,7 @@ float autocorrect_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
# endif
# endif
-bool apply_autocorrect(uint8_t backspaces, const char *str) {
+bool apply_autocorrect(uint8_t backspaces, const char* str) {
if (layer_state_is(_GAMEPAD)) {
return false;
}
@@ -153,7 +153,31 @@ bool apply_autocorrect(uint8_t backspaces, const char *str) {
}
#endif
-#if defined(CAPS_WORD_ENABLE) && !defined(NO_ACTION_ONESHOT)
+#if defined(CAPS_WORD_ENABLE)
+bool caps_word_press_user(uint16_t keycode) {
+ switch (keycode) {
+ // Keycodes that continue Caps Word, with shift applied.
+ case KC_MINS:
+ if (!keymap_config.swap_lctl_lgui) {
+ return true;
+ }
+ case KC_A ... KC_Z:
+ 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:
+ return true;
+
+ default:
+ return false; // Deactivate Caps Word.
+ }
+}
+
+# if !defined(NO_ACTION_ONESHOT)
void oneshot_locked_mods_changed_user(uint8_t mods) {
if (mods & MOD_MASK_SHIFT) {
del_mods(MOD_MASK_SHIFT);
@@ -161,4 +185,25 @@ void oneshot_locked_mods_changed_user(uint8_t mods) {
caps_word_on();
}
}
+# endif
#endif
+
+void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t default_state) {
+ for (int i = 0; i < 16; i++) {
+ if (i == 0 || i == 4 || i == 8 || i == 12) {
+ *buffer = ' ';
+ ++buffer;
+ }
+
+ uint8_t layer = i;
+ if ((default_state & ((layer_state_t)1 << layer)) != 0) {
+ *buffer = 'D';
+ } else if ((state & ((layer_state_t)1 << layer)) != 0) {
+ *buffer = '1';
+ } else {
+ *buffer = '_';
+ }
+ ++buffer;
+ }
+ *buffer = 0;
+}