diff options
author | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
commit | e4f4ceaf3f2e3d25fb282273a81f9b58790fc427 (patch) | |
tree | c0a257eab0ffe5238fdf2c04882e8ee1fe8fc46e /users/drashna/keyrecords | |
parent | 103badc87cb50db1ff3851c84331e86ba78fb681 (diff) |
merge upstream 713427c
Diffstat (limited to 'users/drashna/keyrecords')
-rw-r--r-- | users/drashna/keyrecords/capwords.md | 36 | ||||
-rw-r--r-- | users/drashna/keyrecords/process_records.c | 35 | ||||
-rw-r--r-- | users/drashna/keyrecords/process_records.h | 17 | ||||
-rw-r--r-- | users/drashna/keyrecords/readme.md | 2 | ||||
-rw-r--r-- | users/drashna/keyrecords/tap_dance.md | 4 | ||||
-rw-r--r-- | users/drashna/keyrecords/tap_dances.c | 4 | ||||
-rw-r--r-- | users/drashna/keyrecords/tapping.c | 23 | ||||
-rw-r--r-- | users/drashna/keyrecords/wrappers.h | 2 |
8 files changed, 42 insertions, 81 deletions
diff --git a/users/drashna/keyrecords/capwords.md b/users/drashna/keyrecords/capwords.md deleted file mode 100644 index 1ca01ed853..0000000000 --- a/users/drashna/keyrecords/capwords.md +++ /dev/null @@ -1,36 +0,0 @@ -# Cap Words - -This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/caps-word/index.html), with a number of modifications. - -To enable Caps Word, add `CAPS_WORD_ENABLE = yes` to your `rules.mk`. - -This is mostly a reproduction of Pascal's docs: - -## Overview - -All-caps identifiers like “MOD_MASK_ALT” are awkward to type. - -Caps Lock would be the standard solution to this problem, but it is awkward: it needs a dedicated key to toggle it (an imposition on smaller keyboards), and we need to remember to toggle it off after typing the word. Or with normal shifting, we either perform finger gymnastics or need to stop typing in the middle of the word to release shift with one hand to switch to holding shift with the other hand. In my experience, this is a nuisance especially if your shift keys are mod-taps, as in home row mods. - -Caps Word, implemented here, is a modern alternative to Caps Lock: - -* Caps Word is activated by pressing the left and right shift keys at the same time. This way you don’t need a dedicated key for using Caps Word. -* Caps Word automatically disables itself at the end of the word. - -**Compatibility**: I’ve tested that this implementation works with one-shot mods and Space Cadet Shift, and it predictably handles key repeating. - -Unlike some other QMK Caps Word implementations, this library does not use the Caps Lock (KC_CAPS) keycode. It works even if the OS remaps Caps Lock to Ctrl or something else, as Emacs and Vim users often do. - -## Using Caps Word -With the above flashed to your keyboard: - -1. **Activating**: Press and release both left and right shift keys at the same time. If your shift keys are mod-taps, activate Caps Word by holding both shift mod-tap keys until the tapping term, then release them. -2. Then begin typing to get capitalized letters. -3. **Disabling**: Caps Word disables itself when the next word breaking key is typed. - -If you want to explicitly stop Caps Word, press and release Ctrl or another non-shift modifier or layer key. This also disables Caps Word. - -## Explanation -The code checks the mod bits on each key event, enabling Caps Word when both left and right shifts are active. - -While enabled, Caps Word automatically presses and releases left shift (KC_LSFT) as needed so that letters are shifted and other keys are not. The word continues while typing a–z, 0–9, -, _, and backspace. Any other key is considered “word breaking” and disables Caps Word. You can edit the switch statement at the end of the process_caps_word() function to adjust which keys count as word breaking. diff --git a/users/drashna/keyrecords/process_records.c b/users/drashna/keyrecords/process_records.c index 89d1c80b8f..99d95c3dff 100644 --- a/users/drashna/keyrecords/process_records.c +++ b/users/drashna/keyrecords/process_records.c @@ -3,6 +3,9 @@ #include "drashna.h" #include "version.h" +#ifdef OS_DETECTION_ENABLE +# include "os_detection.h" +#endif uint16_t copy_paste_timer; bool host_driver_disabled = false; @@ -32,15 +35,6 @@ __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t * @return false Stop process keycode and do not send to host */ bool process_record_user(uint16_t keycode, keyrecord_t *record) { -#ifdef ENCODER_ENABLE // some debouncing for weird issues - if (IS_ENCODEREVENT(record->event)) { - static bool ignore_first = true; - if (ignore_first) { - ignore_first = false; - return false; - } - } -#endif // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %1d, time: %5u, int: %1d, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); @@ -195,6 +189,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; } + case OLED_LOCK: { +#if defined(OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) + extern bool is_oled_locked; + if (record->event.pressed) { + is_oled_locked = !is_oled_locked; + if (is_oled_locked) { + oled_on(); + } + } +#endif + } break; +#if defined(OS_DETECTION_ENABLE) && defined(OS_DETECTION_DEBUG_ENABLE) + case STORE_SETUPS: + if (record->event.pressed) { + store_setups_in_eeprom(); + } + return false; + case PRINT_SETUPS: + if (record->event.pressed) { + print_stored_setups(); + } + return false; +#endif } return true; } diff --git a/users/drashna/keyrecords/process_records.h b/users/drashna/keyrecords/process_records.h index 0acd7e010d..8073b7adb0 100644 --- a/users/drashna/keyrecords/process_records.h +++ b/users/drashna/keyrecords/process_records.h @@ -4,16 +4,8 @@ #pragma once #include "drashna.h" -#if defined(KEYBOARD_handwired_tractyl_manuform) && defined(POINTING_DEVICE_ENABLE) -# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE -#elif defined(KEYBOARD_bastardkb_charybdis) -# define PLACEHOLDER_SAFE_RANGE CHARYBDIS_SAFE_RANGE -#else -# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE -#endif - enum userspace_custom_keycodes { - VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info + VRSN = QK_USER, // Prints QMK Firmware and board info KC_QWERTY, // Sets default layer to QWERTY FIRST_DEFAULT_LAYER_KEYCODE = KC_QWERTY, // Sets default layer to QWERTY KC_COLEMAK_DH, // Sets default layer to COLEMAK @@ -47,7 +39,12 @@ enum userspace_custom_keycodes { KC_SUPER, KC_COMIC, KC_ACCEL, - NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes + OLED_LOCK, + + STORE_SETUPS, + PRINT_SETUPS, + + USER_SAFE_RANGE, // use "NEWPLACEHOLDER for keymap specific codes }; bool process_record_secrets(uint16_t keycode, keyrecord_t *record); diff --git a/users/drashna/keyrecords/readme.md b/users/drashna/keyrecords/readme.md index 5f708f9edf..b89777db3d 100644 --- a/users/drashna/keyrecords/readme.md +++ b/users/drashna/keyrecords/readme.md @@ -1,7 +1,5 @@ # Keycode handling and interception - * [Autocorrection](autocorrection/readme.md) - * [Cap Words](capwords.md) * [Diablo Tap Dancing](tap_dance.md) * [Keymap Wrappers](wrappers.md) * [Secret Macros](secrets.md) diff --git a/users/drashna/keyrecords/tap_dance.md b/users/drashna/keyrecords/tap_dance.md index fef1435918..9dff96640f 100644 --- a/users/drashna/keyrecords/tap_dance.md +++ b/users/drashna/keyrecords/tap_dance.md @@ -30,7 +30,7 @@ These are the custom defined dances that I'm using. It sets up everything for l ```c //Tap Dance Definitions, sets the index and the keycode. -qk_tap_dance_action_t tap_dance_actions[] = { +tap_dance_action_t tap_dance_actions[] = { // tap once to disable, and more to enable timed micros [TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0, KC_1), [TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1, KC_2), @@ -82,7 +82,7 @@ The first part of the magic here is the `diablo_tapdance_master` function. The ```c // Cycle through the times for the macro, starting at 0, for disabled. -void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { +void diablo_tapdance_master(tap_dance_state_t *state, void *user_data) { diable_keys_t *diablo_keys = (diable_keys_t *)user_data; // Sets the keycode based on the index diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; diff --git a/users/drashna/keyrecords/tap_dances.c b/users/drashna/keyrecords/tap_dances.c index 7bdea3cae3..87739c2a18 100644 --- a/users/drashna/keyrecords/tap_dances.c +++ b/users/drashna/keyrecords/tap_dances.c @@ -17,7 +17,7 @@ uint8_t diablo_times[] = {0, 1, 3, 5, 10, 30}; * @param state Main data struction contining information about events * @param user_data Local data for the dance. Allows customization to be passed on to function */ -void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { +void diablo_tapdance_master(tap_dance_state_t *state, void *user_data) { diable_keys_t *diablo_keys = (diable_keys_t *)user_data; // Sets the keycode based on the index diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; @@ -40,7 +40,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { // clang-format on // Tap Dance Definitions, sets the index and the keycode. -qk_tap_dance_action_t tap_dance_actions[] = { +tap_dance_action_t tap_dance_actions[] = { // tap once to disable, and more to enable timed micros [TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0, KC_1), [TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1, KC_2), diff --git a/users/drashna/keyrecords/tapping.c b/users/drashna/keyrecords/tapping.c index 7496610c2f..6a26a02aca 100644 --- a/users/drashna/keyrecords/tapping.c +++ b/users/drashna/keyrecords/tapping.c @@ -42,29 +42,14 @@ __attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyreco } #endif // HOLD_ON_OTHER_KEY_PRESS_PER_KEY -#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY -__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { - // Do not force the mod-tap key press to be handled as a modifier - // if any other key was pressed while the mod-tap key is held down. - // return true; - // Force the mod-tap key press to be handled as a modifier if any - // other key was pressed while the mod-tap key is held down. - // return false; - switch (keycode) { - default: - return true; - } -} -#endif // IGNORE_MOD_TAP_INTERRUPT_PER_KEY - -#ifdef TAPPING_FORCE_HOLD_PER_KEY -__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { +#ifdef QUICK_TAP_TERM_PER_KEY +__attribute__((weak)) uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { default: - return false; + return QUICK_TAP_TERM; } } -#endif // TAPPING_FORCE_HOLD_PER_KEY +#endif // QUICK_TAP_TERM_PER_KEY #ifdef RETRO_TAPPING_PER_KEY __attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { diff --git a/users/drashna/keyrecords/wrappers.h b/users/drashna/keyrecords/wrappers.h index cb8dc6189a..31efad5f6e 100644 --- a/users/drashna/keyrecords/wrappers.h +++ b/users/drashna/keyrecords/wrappers.h @@ -256,7 +256,7 @@ NOTE: These are all the same length. If you do a search/replace #define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG -#define _________________ADJUST_L2_________________ MU_TOG , CK_TOGG, AU_ON, AU_OFF, CG_NORM +#define _________________ADJUST_L2_________________ MU_TOGG, CK_TOGG, AU_ON, AU_OFF, CG_NORM #define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T #define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 |