diff options
Diffstat (limited to 'docs/features')
-rw-r--r-- | docs/features/bluetooth.md | 10 | ||||
-rw-r--r-- | docs/features/combo.md | 44 |
2 files changed, 49 insertions, 5 deletions
diff --git a/docs/features/bluetooth.md b/docs/features/bluetooth.md index 1dbf15f4e1..d3634498be 100644 --- a/docs/features/bluetooth.md +++ b/docs/features/bluetooth.md @@ -39,8 +39,8 @@ BLUETOOTH_DRIVER = bluefruit_le # or rn42 This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both. -|Key |Aliases |Description | -|---------------------|---------|----------------------------------------------| -|`QK_OUTPUT_AUTO` |`OU_AUTO`|Automatically switch between USB and Bluetooth| -|`QK_OUTPUT_USB` |`OU_USB` |USB only | -|`QK_OUTPUT_BLUETOOTH`|`OU_BT` |Bluetooth only | +| Key | Aliases | Description | +|-----------------------|----------------------|------------------------------------------------| +| `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth | +| `QK_OUTPUT_USB` | `OU_USB` | USB only | +| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only | diff --git a/docs/features/combo.md b/docs/features/combo.md index bdb8c4b15f..10e33b72a6 100644 --- a/docs/features/combo.md +++ b/docs/features/combo.md @@ -307,6 +307,50 @@ bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key return false; } ``` + +### Customizable key repress +By defining `COMBO_PROCESS_KEY_REPRESS` and implementing `bool process_combo_key_repress(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode)` you can run your custom code when you repress just released key of a combo. By combining it with custom `process_combo_event` we can for example make special handling for Alt+Tab to switch windows, which, on combo F+G activation, registers Alt and presses Tab - then we can switch windows forward by releasing G and pressing it again, or backwards with F key. Here's the full example: + +```c +enum combos { + CMB_ALTTAB +}; + +const uint16_t PROGMEM combo_alttab[] = {KC_F, KC_G, COMBO_END}; + +combo_t key_combos[COMBO_LENGTH] = { + [CMB_ALTTAB] = COMBO(combo_alttab, KC_NO), // KC_NO to leave processing for process_combo_event +}; + +void process_combo_event(uint16_t combo_index, bool pressed) { + switch (combo_index) { + case CMB_ALTTAB: + if (pressed) { + register_mods(MOD_LALT); + tap_code(KC_TAB); + } else { + unregister_mods(MOD_LALT); + } + break; + } +} + +bool process_combo_key_repress(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) { + switch (combo_index) { + case CMB_ALTTAB: + switch (keycode) { + case KC_F: + tap_code16(S(KC_TAB)); + return true; + case KC_G: + tap_code(KC_TAB); + return true; + } + } + return false; +} +``` + ### Layer independent combos If you, for example, use multiple base layers for different key layouts, one for QWERTY, and another one for Colemak, you might want your combos to work from the same key positions on all layers. Defining the same combos again for another layout is redundant and takes more memory. The solution is to just check the keycodes from one layer. |