diff --git a/src/Kaleidoscope/TypingBreaks.cpp b/src/Kaleidoscope/TypingBreaks.cpp index 24168232..356caf9f 100644 --- a/src/Kaleidoscope/TypingBreaks.cpp +++ b/src/Kaleidoscope/TypingBreaks.cpp @@ -60,6 +60,8 @@ namespace KaleidoscopePlugins { lockStartTime = 0; leftHandKeys = rightHandKeys = 0; sessionStartTime = millis (); + + TypingBreak (false); } // Any other case, we are not locked yet! (or we just unlocked) @@ -75,12 +77,14 @@ namespace KaleidoscopePlugins { // If we have a limit on the left hand, and we reached it, lock up! if (settings.leftHandMaxKeys && leftHandKeys >= settings.leftHandMaxKeys) { lockStartTime = millis (); + TypingBreak (true); return Key_NoKey; } // If we have a limit on the right hand, and we reached it, lock up! if (settings.rightHandMaxKeys && rightHandKeys >= settings.rightHandMaxKeys) { lockStartTime = millis (); + TypingBreak (true); return Key_NoKey; } @@ -89,6 +93,7 @@ namespace KaleidoscopePlugins { if (millis () - sessionStartTime >= settings.lockTimeOut) { // Yeah, it is. lockStartTime = millis (); + TypingBreak (true); return Key_NoKey; } } @@ -191,3 +196,8 @@ namespace KaleidoscopePlugins { }; KaleidoscopePlugins::TypingBreaks TypingBreaks; + +__attribute__((weak)) +void +TypingBreak (bool isLocked) { +} diff --git a/src/Kaleidoscope/TypingBreaks.h b/src/Kaleidoscope/TypingBreaks.h index 9ef8a858..cea9133c 100644 --- a/src/Kaleidoscope/TypingBreaks.h +++ b/src/Kaleidoscope/TypingBreaks.h @@ -55,6 +55,8 @@ namespace KaleidoscopePlugins { extern KaleidoscopePlugins::TypingBreaks TypingBreaks; +void TypingBreak (bool isLocked); + #define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \ "typingbreaks.idleTimeLimit\n" \ "typingbreaks.lockTimeOut\n" \