diff --git a/boards/boardsource/unicorne/README.md b/boards/boardsource/unicorne/README.md index 6994d86f0..148a3978c 100644 --- a/boards/boardsource/unicorne/README.md +++ b/boards/boardsource/unicorne/README.md @@ -13,5 +13,5 @@ Extensions enabled by default - [Layers](/docs/en/layers.md) Need more keys than switches? Use layers. - [PEG_RGB](/docs/en/peg_rgb_matrix.md) Light it up! - [Display](/docs/en/display.md) Show information on the mini OLED display -- [Oneshot](/docs/en/oneshot.md) Dead keys, for faster typing +- [StickyKeys](/docs/en/sticky_keys.md) Sticky keys, for faster typing - [Combos](/docs/en/combos) Making more keys from pushing multiple keys. diff --git a/boards/boardsource/unicorne/main.py b/boards/boardsource/unicorne/main.py index 3ae10fc02..402780f5a 100644 --- a/boards/boardsource/unicorne/main.py +++ b/boards/boardsource/unicorne/main.py @@ -13,23 +13,22 @@ from kmk.modules.layers import Layers from kmk.modules.macros import Macros from kmk.modules.modtap import ModTap -from kmk.modules.oneshot import OneShot from kmk.modules.split import Split, SplitSide +from kmk.modules.sticky_keys import StickyKeys supervisor.runtime.autoreload = False keyboard = KMKKeyboard() macros = Macros() modtap = ModTap() combos = Combos() -oneshot = OneShot() +sticky_keys = StickyKeys(release_after=450) layers = Layers() -oneshot.tap_time = 450 -OS_LCTL = KC.OS(KC.LCTL) -OS_LSFT = KC.OS(KC.LSFT) -OS_LALT = KC.OS(KC.LALT) -keyboard.modules.append(oneshot) +SK_LCTL = KC.SK(KC.LCTL) +SK_LSFT = KC.SK(KC.LSFT) +SK_LALT = KC.SK(KC.LALT) +keyboard.modules.append(sticky_keys) keyboard.modules.append(layers) keyboard.modules.append(modtap) keyboard.modules.append(combos) @@ -107,8 +106,8 @@ # DVORAK KC.ESC, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BSPC, \ TAB_SB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT, \ - OS_LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH, \ - OS_LALT, SUPER_L, LT1_SP, LT2_SP, OS_LCTL, KC.NO, + SK_LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH, \ + SK_LALT, SUPER_L, LT1_SP, LT2_SP, SK_LCTL, KC.NO, ], # GAMING diff --git a/boards/fingerpunch/ffkb/nice_nano/main.py b/boards/fingerpunch/ffkb/nice_nano/main.py index 5069ffcdf..28cb778ee 100644 --- a/boards/fingerpunch/ffkb/nice_nano/main.py +++ b/boards/fingerpunch/ffkb/nice_nano/main.py @@ -4,7 +4,7 @@ from kmk.modules.combos import Combos, Sequence from kmk.modules.dynamic_sequences import DynamicSequences from kmk.modules.layers import Layers -from kmk.modules.oneshot import OneShot +from kmk.modules.sticky_keys import StickyKeys combos = Combos() dyn_seq = DynamicSequences( @@ -14,10 +14,10 @@ use_recorded_speed=False, # Whether to play the sequence at the speed it was typed ) layers = Layers() -oneshot = OneShot() +sticky_keys = StickyKeys() keyboard = kb.KMKKeyboard() -keyboard.modules = [combos, dyn_seq, layers, oneshot] +keyboard.modules = [combos, dyn_seq, layers, sticky_keys] keyboard.debug_enabled = False # Convenience variables for the Keymap @@ -27,7 +27,7 @@ L1_TAB = KC.LT(1, KC.TAB, prefer_hold=True) L2_ENT = KC.LT(2, KC.ENT, prefer_hold=True) -OS_LSFT = KC.OS(KC.LSFT) +SK_LSFT = KC.SK(KC.LSFT) SEQ_REC = KC.RECORD_SEQUENCE() SEQ_STP = KC.STOP_SEQUENCE() @@ -48,7 +48,7 @@ KC.ESC, KC.Q, KC.W, KC.F, KC.P, KC.B, KC.J, KC.L, KC.U, KC.Y, KC.SCLN, KC.LEADER, KC.LCTL, KC.A, KC.R, KC.S, KC.T, KC.G, xxxxxxx, KC.M, KC.N, KC.E, KC.I, KC.O, KC.QUOT, KC.LALT, KC.Z, KC.X, KC.C, KC.D, KC.V, KC.K, KC.H, KC.COMM, KC.DOT, KC.SLSH, KC.BSLS, - xxxxxxx, KC.LGUI, OS_LSFT, KC.BSPC, L1_TAB, KC.SPACE, L2_ENT, xxxxxxx, + xxxxxxx, KC.LGUI, SK_LSFT, KC.BSPC, L1_TAB, KC.SPACE, L2_ENT, xxxxxxx, ], [ # 1: Nav & Numbers KC.TAB, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL, diff --git a/boards/hillside/46/main.py b/boards/hillside/46/main.py index 18388d10a..66c2b888a 100644 --- a/boards/hillside/46/main.py +++ b/boards/hillside/46/main.py @@ -6,8 +6,8 @@ from kmk.modules.capsword import CapsWord from kmk.modules.cg_swap import CgSwap from kmk.modules.layers import Layers -from kmk.modules.oneshot import OneShot from kmk.modules.split import Split +from kmk.modules.sticky_keys import StickyKeys keyboard = KMKKeyboard() keyboard.extensions.append(MediaKeys()) @@ -20,11 +20,11 @@ keyboard.modules.append(CapsWord()) keyboard.modules.append(CgSwap()) keyboard.modules.append(Layers()) -keyboard.modules.append(OneShot()) +keyboard.modules.append(StickyKeys()) split = Split(data_pin=keyboard.data_pin) keyboard.modules.append(split) -OS_LSFT = KC.OS(KC.LSFT) +SK_LSFT = KC.SK(KC.LSFT) LYR3 = KC.MO(3) LYR4 = KC.MO(4) LYR5 = KC.MO(5) @@ -33,7 +33,7 @@ PSTE = KC.LCTL(KC.V) UNDO = KC.LCTL(KC.Z) REDO = KC.LCTL(KC.Y) -OS_RALT = KC.OS(KC.RALT) +SK_RALT = KC.SK(KC.RALT) RGB_M_P = KC.RGB_MODE_PLAIN RGB_M_B = KC.RGB_MODE_BREATHE RGB_M_R = KC.RGB_MODE_RAINBOW @@ -47,7 +47,7 @@ KC.GRV, KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P, KC.BSPC, KC.TAB, KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.SCLN, KC.ENT, KC.LCTL, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.ESC, KC.CW, KC.N, KC.M, KC.COMM, KC.DOT, KC.SLSH, KC.QUOT, - KC.LGUI, KC.LALT, OS_LSFT, LYR3, LYR4, KC.SPC, KC.LALT, KC.RGUI, + KC.LGUI, KC.LALT, SK_LSFT, LYR3, LYR4, KC.SPC, KC.LALT, KC.RGUI, ], [ #DVORAK KC.TRNS, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.TRNS, @@ -70,7 +70,7 @@ [ KC.HOME, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.DEL, KC.END, KC.LGUI, KC.LALT, KC.LCTL, KC.LSFT, KC.INS, KC.LBRC, KC.RBRC, KC.MINS, KC.EQL, KC.BSLS, KC.TRNS, - KC.TRNS, KC.PIPE, KC.UNDS, KC.PLUS, KC.LCBR, KC.RCBR, OS_RALT, KC.APP, KC.MUTE, KC.VOLD, KC.VOLU, KC.MPLY, KC.NO, KC.RCTL, + KC.TRNS, KC.PIPE, KC.UNDS, KC.PLUS, KC.LCBR, KC.RCBR, SK_RALT, KC.APP, KC.MUTE, KC.VOLD, KC.VOLU, KC.MPLY, KC.NO, KC.RCTL, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, LYR5, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, ], [ diff --git a/boards/hillside/48/main.py b/boards/hillside/48/main.py index 38d6b7eb4..6f17c17d5 100644 --- a/boards/hillside/48/main.py +++ b/boards/hillside/48/main.py @@ -6,8 +6,8 @@ from kmk.modules.capsword import CapsWord from kmk.modules.cg_swap import CgSwap from kmk.modules.layers import Layers -from kmk.modules.oneshot import OneShot from kmk.modules.split import Split +from kmk.modules.sticky_keys import StickyKeys keyboard = KMKKeyboard() keyboard.extensions.append(MediaKeys()) @@ -20,11 +20,11 @@ keyboard.modules.append(CapsWord()) keyboard.modules.append(CgSwap()) keyboard.modules.append(Layers()) -keyboard.modules.append(OneShot()) +keyboard.modules.append(StickyKeys()) split = Split(data_pin=keyboard.data_pin) keyboard.modules.append(split) -OS_LSFT = KC.OS(KC.LSFT) +SK_LSFT = KC.SK(KC.LSFT) LYR3 = KC.MO(3) LYR4 = KC.MO(4) LYR5 = KC.MO(5) @@ -33,7 +33,7 @@ PSTE = KC.LCTL(KC.V) UNDO = KC.LCTL(KC.Z) REDO = KC.LCTL(KC.Y) -OS_RALT = KC.OS(KC.RALT) +SK_RALT = KC.SK(KC.RALT) RGB_M_P = KC.RGB_MODE_PLAIN RGB_M_B = KC.RGB_MODE_BREATHE RGB_M_R = KC.RGB_MODE_RAINBOW @@ -47,7 +47,7 @@ KC.GRV, KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P, KC.BSPC, KC.TAB, KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.SCLN, KC.ENT, KC.LSFT, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.ESC, KC.CW, KC.N, KC.M, KC.COMM, KC.DOT, KC.SLSH, KC.RSFT, - KC.LCTL, KC.LGUI, KC.LALT, LYR3, OS_LSFT, LYR4, KC.SPC, KC.LALT, KC.RGUI, KC.QUOT, + KC.LCTL, KC.LGUI, KC.LALT, LYR3, SK_LSFT, LYR4, KC.SPC, KC.LALT, KC.RGUI, KC.QUOT, ], [ #DVORAK KC.TRNS, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.TRNS, @@ -64,7 +64,7 @@ [ KC.HOME, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.DEL, KC.END, KC.LGUI, KC.LALT, KC.LCTL, KC.LSFT, KC.INS, KC.LBRC, KC.RBRC, KC.MINS, KC.EQL, KC.BSLS, KC.TRNS, - KC.TRNS, KC.NO, KC.VOLD, KC.MUTE, KC.VOLU, KC.MPLY, OS_RALT, KC.APP, KC.LCBR, KC.RCBR, KC.UNDS, KC.PLUS, KC.PIPE, KC.TRNS, + KC.TRNS, KC.NO, KC.VOLD, KC.MUTE, KC.VOLU, KC.MPLY, SK_RALT, KC.APP, KC.LCBR, KC.RCBR, KC.UNDS, KC.PLUS, KC.PIPE, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, LYR5, KC.TRNS, KC.TRNS, KC.TRNS, KC.RCTL, ], [ diff --git a/boards/hillside/52/main.py b/boards/hillside/52/main.py index ebf70a502..74e9beed9 100644 --- a/boards/hillside/52/main.py +++ b/boards/hillside/52/main.py @@ -6,8 +6,8 @@ from kmk.modules.capsword import CapsWord from kmk.modules.cg_swap import CgSwap from kmk.modules.layers import Layers -from kmk.modules.oneshot import OneShot from kmk.modules.split import Split +from kmk.modules.sticky_keys import StickyKeys keyboard = KMKKeyboard() keyboard.extensions.append(MediaKeys()) @@ -20,11 +20,11 @@ keyboard.modules.append(CapsWord()) keyboard.modules.append(CgSwap()) keyboard.modules.append(Layers()) -keyboard.modules.append(OneShot()) +keyboard.modules.append(StickyKeys()) split = Split(data_pin=keyboard.data_pin) keyboard.modules.append(split) -OS_LSFT = KC.OS(KC.LSFT) +SK_LSFT = KC.SK(KC.LSFT) LYR3 = KC.MO(3) LYR4 = KC.MO(4) LYR5 = KC.MO(5) @@ -47,7 +47,7 @@ KC.GRV, KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P, KC.BSPC, KC.TAB, KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.SCLN, KC.ENT, KC.LSFT, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.QUOT, KC.SLSH, KC.N, KC.M, KC.COMM, KC.DOT, KC.UP, KC.RSFT, - KC.MUTE, KC.ESC, KC.LCTL, KC.LGUI, KC.LALT, OS_LSFT, LYR3, LYR4, KC.SPC, KC.LALT, KC.RGUI, KC.LEFT, KC.DOWN, KC.RGHT + KC.MUTE, KC.ESC, KC.LCTL, KC.LGUI, KC.LALT, SK_LSFT, LYR3, LYR4, KC.SPC, KC.LALT, KC.RGUI, KC.LEFT, KC.DOWN, KC.RGHT ], [ #DVORAK KC.TRNS, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.TRNS, diff --git a/boards/hillside/56/main.py b/boards/hillside/56/main.py index 0bfaa0337..68778909c 100644 --- a/boards/hillside/56/main.py +++ b/boards/hillside/56/main.py @@ -6,8 +6,8 @@ from kmk.modules.capsword import CapsWord from kmk.modules.cg_swap import CgSwap from kmk.modules.layers import Layers -from kmk.modules.oneshot import OneShot from kmk.modules.split import Split +from kmk.modules.sticky_keys import StickyKeys keyboard = KMKKeyboard() keyboard.extensions.append(MediaKeys()) @@ -20,15 +20,15 @@ keyboard.modules.append(CapsWord()) keyboard.modules.append(CgSwap()) keyboard.modules.append(Layers()) -keyboard.modules.append(OneShot()) +keyboard.modules.append(StickyKeys()) split = Split(data_pin=keyboard.data_pin) keyboard.modules.append(split) -OS_LSFT = KC.OS(KC.LSFT) +SK_LSFT = KC.SK(KC.LSFT) LYR3 = KC.MO(3) LYR4 = KC.MO(4) LYR5 = KC.MO(5) -OS_RALT = KC.OS(KC.RALT) +SK_RALT = KC.SK(KC.RALT) RGB_M_P = KC.RGB_MODE_PLAIN RGB_M_B = KC.RGB_MODE_BREATHE RGB_M_R = KC.RGB_MODE_RAINBOW @@ -62,7 +62,7 @@ [ KC.INS, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.TRNS, KC.TRNS, KC.LGUI, KC.LALT, KC.LCTL, KC.LSFT, KC.NO, KC.MINS, KC.EQL, KC.LBRC, KC.RBRC, KC.BSLS, KC.TRNS, - KC.TRNS, KC.NO, KC.NO, KC.NO, KC.NO, KC.NO, OS_RALT, KC.APP, KC.UNDS, KC.PLUS, KC.LCBR, KC.RCBR, KC.PIPE, KC.TRNS, + KC.TRNS, KC.NO, KC.NO, KC.NO, KC.NO, KC.NO, SK_RALT, KC.APP, KC.UNDS, KC.PLUS, KC.LCBR, KC.RCBR, KC.PIPE, KC.TRNS, KC.TRNS, KC.NO, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, LYR5, KC.DEL, KC.TRNS, KC.TRNS, KC.PGUP, KC.TRNS, KC.NO, KC.NO, KC.NO, KC.HOME, KC.PGDN, KC.END, ], diff --git a/boards/hillside/README.md b/boards/hillside/README.md index cc0e6a8d6..77ddcefe7 100644 --- a/boards/hillside/README.md +++ b/boards/hillside/README.md @@ -25,7 +25,7 @@ Extensions & modules enabled by default: - [RGB](/docs/en/rgb.md) - [MediaKeys](/docs/en/media_keys.md) - [CgSwap](/docs/en/cg_swap.md) -- [OneShot](/docs/en/oneshot.md) +- [StickyKeys](/docs/en/sticky_keys.md) - [CapsWord](/docs/en/capsword.md) ## Microcontroller support diff --git a/docs/en/oneshot.md b/docs/en/oneshot.md deleted file mode 100644 index 8b95f2cf8..000000000 --- a/docs/en/oneshot.md +++ /dev/null @@ -1,57 +0,0 @@ -# OneShot Keycodes - -> [!WARNING] -> OneShot Keys have been deprecated in favor of [Sticky Keys](sticky_keys.md) -> and will be removed at a future date. - -OneShot keys enable you to have keys that keep staying pressed -for a certain time or until another key is pressed and released. -If the timeout expires or other keys are pressed, and the OneShot key wasn't -released, it is handled as a regular key hold. - -## Enable OneShot Keys - -```python -from kmk.modules.oneshot import OneShot -oneshot = OneShot() -# optional: set a custom tap timeout in ms (default: 1000ms) -# oneshot.tap_time = 1500 -keyboard.modules.append(oneshot) -``` - -## Keycodes - -|Keycode | Aliases |Description | -|-----------------|--------------|-----------------------------------| -|`KC.OS(KC.ANY)` | `KC.ONESHOT` |make a oneshot version of `KC.ANY` | - -`KC.ONESHOT` accepts any valid key code as argument, including modifiers and KMK -internal keys like momentary layer shifts. - -## Custom OneShot Behavior - -The full OneShot signature is as follows: - -```python -KC.OS( - KC.TAP, # the oneshot keycode - tap_time=None # length of the tap timeout in milliseconds - ) -``` - - -## OneShot Modifier Combinations - -The OneShot keys can be chained. In this example if you press `OS_LCTL` and then `OS_LSFT` followed by `KC.TAB`, the output will be `ctrl+shift+tab`. - -```python -from kmk.modules.oneshot import OneShot - -oneshot = OneShot() -keyboard.modules.append(oneshot) - -OS_LCTL = KC.OS(KC.LCTL, tap_time=None) -OS_LSFT = KC.OS(KC.LSFT, tap_time=None) - -keyboard.keymap = [[OS_LSFT, OS_LCTL, KC.TAB]] -``` diff --git a/kmk/modules/oneshot.py b/kmk/modules/oneshot.py deleted file mode 100644 index ced42d76f..000000000 --- a/kmk/modules/oneshot.py +++ /dev/null @@ -1,100 +0,0 @@ -from kmk.keys import make_argumented_key -from kmk.modules.holdtap import ActivationType, HoldTap, HoldTapKey -from kmk.modules.layers import LayerKey -from kmk.utils import Debug - -debug = Debug(__name__) - - -class OneShotKey(HoldTapKey): - def __init__(self, kc, tap_time=None, **kwargs): - super().__init__( - tap=kc, - hold=kc, - prefer_hold=False, - tap_interrupted=False, - tap_time=tap_time, - repeat=0, - **kwargs, - ) - - -class OneShot(HoldTap): - '''This module is deprecated; use sticky_keys instead.''' - - tap_time = 1000 - - def __init__(self): - super().__init__() - debug( - 'Warning: OneShot module is deprecated and will be removed; use sticky_keys instead.' - ) - make_argumented_key( - names=('OS', 'ONESHOT'), - constructor=OneShotKey, - on_press=self.osk_pressed, - on_release=self.osk_released, - ) - - def process_key(self, keyboard, current_key, is_pressed, int_coord): - '''Release os key after interrupting non-os keyup, or reset timeout and - stack multiple os keys.''' - send_buffer = False - - for key, state in self.key_states.items(): - if key == current_key: - continue - - if (isinstance(current_key, OneShotKey)) or ( - isinstance(current_key, LayerKey) - ): - keyboard.cancel_timeout(state.timeout_key) - if key.tap_time is None: - tap_time = self.tap_time - else: - tap_time = key.tap_time - state.timeout_key = keyboard.set_timeout( - tap_time, - lambda k=key: self.on_tap_time_expired(k, keyboard), - ) - continue - - if state.activated == ActivationType.PRESSED and is_pressed: - state.activated = ActivationType.HOLD_TIMEOUT - elif state.activated == ActivationType.RELEASED and is_pressed: - state.activated = ActivationType.INTERRUPTED - elif state.activated == ActivationType.INTERRUPTED: - if is_pressed: - send_buffer = True - self.key_buffer.insert(0, (None, key, False)) - - if send_buffer: - self.key_buffer.append((int_coord, current_key, is_pressed)) - current_key = None - - self.send_key_buffer(keyboard) - - return current_key - - def osk_pressed(self, key, keyboard, *args, **kwargs): - '''Register HoldTap mechanism and activate os key.''' - self.ht_pressed(key, keyboard, *args, **kwargs) - self.ht_activate_tap(key, keyboard, *args, **kwargs) - self.send_key_buffer(keyboard) - return keyboard - - def osk_released(self, key, keyboard, *args, **kwargs): - '''On keyup, mark os key as released or handle HoldTap.''' - try: - state = self.key_states[key] - except KeyError: - if debug.enabled: - debug(f'OneShot.osk_released: no such key {key}') - return keyboard - - if state.activated == ActivationType.PRESSED: - state.activated = ActivationType.RELEASED - else: - self.ht_released(key, keyboard, *args, **kwargs) - - return keyboard diff --git a/tests/test_oneshot.py b/tests/test_oneshot.py deleted file mode 100644 index 0841f6ebe..000000000 --- a/tests/test_oneshot.py +++ /dev/null @@ -1,152 +0,0 @@ -import unittest - -from kmk.keys import KC -from kmk.modules.layers import Layers -from kmk.modules.oneshot import OneShot -from tests.keyboard_test import KeyboardTest - - -class TestOneshot(unittest.TestCase): - def test_oneshot(self): - t_within = 2 * KeyboardTest.loop_delay_ms - t_after = 10 * KeyboardTest.loop_delay_ms - timeout = (t_after + t_within) // 2 - - # overide default timeouts - OneShot.tap_time = timeout - - keyboard = KeyboardTest( - [Layers(), OneShot()], - [ - [ - KC.OS(KC.MO(1)), - KC.MO(1), - KC.C, - KC.D, - KC.OS(KC.E), - KC.OS(KC.F), - ], - [KC.N0, KC.N1, KC.N2, KC.N3, KC.OS(KC.LSFT), KC.TRNS], - ], - debug_enabled=False, - ) - - keyboard.test( - 'OS timed out', - [(4, True), (4, False), t_after], - [{KC.E}, {}], - ) - - keyboard.test( - 'OS interrupt within tap time', - [(4, True), (4, False), t_within, (3, True), (3, False)], - [{KC.E}, {KC.D, KC.E}, {KC.E}, {}], - ) - - keyboard.test( - 'OS interrupt, multiple within tap time', - [(4, True), (4, False), (3, True), (3, False), (2, True), (2, False)], - [{KC.E}, {KC.D, KC.E}, {KC.E}, {}, {KC.C}, {}], - ) - - keyboard.test( - 'OS interrupt, multiple interleaved', - [(4, True), (4, False), (3, True), (2, True), (2, False), (3, False)], - [{KC.E}, {KC.D, KC.E}, {KC.D}, {KC.C, KC.D}, {KC.D}, {}], - ) - - keyboard.test( - 'OS interrupt, multiple interleaved', - [(4, True), (4, False), (3, True), (2, True), (3, False), (2, False)], - [{KC.E}, {KC.D, KC.E}, {KC.D}, {KC.C, KC.D}, {KC.C}, {}], - ) - - keyboard.test( - 'OS interrupt within tap time, hold', - [(4, True), (3, True), (4, False), t_after, (3, False)], - [{KC.E}, {KC.D, KC.E}, {KC.D}, {}], - ) - - keyboard.test( - 'OS interrupt within tap time, hold', - [(4, True), (4, False), (3, True), t_after, (3, False)], - [{KC.E}, {KC.D, KC.E}, {KC.E}, {}], - ) - - keyboard.test( - 'OS hold with multiple interrupt keys', - [ - (4, True), - t_within, - (3, True), - (3, False), - (2, True), - (2, False), - (4, False), - ], - [{KC.E}, {KC.D, KC.E}, {KC.E}, {KC.C, KC.E}, {KC.E}, {}], - ) - - keyboard.test( - 'OS stacking within timeout reset', - [ - (4, True), - (4, False), - t_within, - (5, True), - (5, False), - t_within, - (3, True), - (3, False), - ], - [{KC.E}, {KC.E, KC.F}, {KC.E, KC.F, KC.D}, {KC.E, KC.F}, {KC.E}, {}], - ) - - keyboard.test( - 'OS stacking timed out', - [ - (4, True), - (4, False), - (5, True), - (5, False), - t_after, - (3, True), - (3, False), - ], - [{KC.E}, {KC.E, KC.F}, {KC.E}, {}, {KC.D}, {}], - ) - - keyboard.test( - 'OS stacking with OS-layer', - [ - (0, True), - (0, False), - (4, True), - (4, False), - (1, True), - (1, False), - ], - [{KC.LSFT}, {KC.LSFT, KC.N1}, {KC.LSFT}, {}], - ) - - keyboard.test( - 'OS stacking with layer change', - [ - (1, True), - (4, True), - (4, False), - (1, False), - (4, True), - (4, False), - (2, True), - (2, False), - ], - [ - {KC.LSFT}, - {KC.LSFT, KC.E}, - {KC.LSFT, KC.E, KC.C}, - {KC.LSFT, KC.E}, - {KC.LSFT}, - {}, - ], - )