Skip to content

Commit

Permalink
Move caps_word_on bool out of header, add is_caps_word_on()
Browse files Browse the repository at this point in the history
  • Loading branch information
halcyonCorsair committed Mar 7, 2022
1 parent c05fe58 commit 370a955
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions users/halcyoncorsair/features/caps_word.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "caps_word.h"

static bool caps_word_on;

// CAPS_WORD: A "smart" Caps Lock key that only capitalizes the next identifier you type
// and then toggles off Caps Lock automatically when you're done.
void caps_word_enable(void) {
Expand Down Expand Up @@ -69,3 +71,7 @@ void process_caps_word(uint16_t keycode, const keyrecord_t *record) {
}
}
}

bool is_caps_word_enabled(void) {
return caps_word_on;
}
3 changes: 1 addition & 2 deletions users/halcyoncorsair/features/caps_word.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include QMK_KEYBOARD_H
#include "halcyoncorsair.h"

// bool is_caps_word_enabled(void);
bool caps_word_on;
bool is_caps_word_enabled(void);
void caps_word_enable(void);
void caps_word_disable(void);
// void toggle_caps_word(void);
Expand Down
2 changes: 1 addition & 1 deletion users/halcyoncorsair/process_records.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
# endif
// Toggle `caps_word_on`
if (record->event.pressed) {
if (caps_word_on) {
if (is_caps_word_enabled()) {
caps_word_disable();
return false;
} else {
Expand Down

0 comments on commit 370a955

Please sign in to comment.