}
}
+bool autoshift_enabled = true;
+
+void autoshift_enable(void) {
+ autoshift_enabled = true;
+}
+void autoshift_disable(void) {
+ autoshift_enabled = false;
+ autoshift_flush();
+}
+
+void autoshift_toggle(void) {
+ if (autoshift_enabled) {
+ autoshift_enabled = false;
+ autoshift_flush();
+ }
+ else {
+ autoshift_enabled = true;
+ }
+}
+
+bool autoshift_state(void) {
+ return autoshift_enabled;
+}
+
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
+#ifndef AUTO_SHIFT_MODIFIERS
static uint8_t any_mod_pressed;
+#endif
if (record->event.pressed) {
switch (keycode) {
autoshift_timer_report();
return false;
+ case KC_ASTG:
+ autoshift_toggle();
+ return false;
+ case KC_ASON:
+ autoshift_enable();
+ return false;
+ case KC_ASOFF:
+ autoshift_disable();
+ return false;
+
#ifndef NO_AUTO_SHIFT_ALPHA
case KC_A:
case KC_B:
case KC_0:
#endif
#ifndef NO_AUTO_SHIFT_SPECIAL
- case KC_TILD:
case KC_MINUS:
case KC_EQL:
case KC_TAB:
case KC_COMM:
case KC_DOT:
case KC_SLSH:
+ case KC_GRAVE:
#endif
+
autoshift_flush();
+ if (!autoshift_enabled) return true;
+#ifndef AUTO_SHIFT_MODIFIERS
any_mod_pressed = get_mods() & (
MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|
MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)|
if (any_mod_pressed) {
return true;
}
+#endif
autoshift_on(keycode);
return false;