From a2cfa92f2fedd7d874b95e1faf5fcb05874a3498 Mon Sep 17 00:00:00 2001 From: Kyle Brown Date: Mon, 4 Mar 2019 15:28:45 -0800 Subject: [PATCH] Missed some obvious things --- docs/keycodes.md | 20 -------------------- docs/modtap.md | 36 +++++++++++++++++++++--------------- kmk/keys.py | 4 ++-- kmk/types.py | 2 +- 4 files changed, 24 insertions(+), 38 deletions(-) diff --git a/docs/keycodes.md b/docs/keycodes.md index 0708371..e3de088 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md @@ -229,23 +229,3 @@ |`KC.RALT(kc)`|Hold Right Alt and press `kc` | |`KC.RGUI(kc)`|Hold Right GUI and press `kc` | - -## [Mod-Tap Keys] NOT IMPLEMENTED AT THIS TIME - -|Key |Aliases |Description | -|------------|---------------------------------------|-------------------------------------------------------| -|`LCTL_T(kc)`|`CTL_T(kc)` |Left Control when held, `kc` when tapped | -|`RCTL_T(kc)`| |Right Control when held, `kc` when tapped | -|`LSFT_T(kc)`|`SFT_T(kc)` |Left Shift when held, `kc` when tapped | -|`RSFT_T(kc)`| |Right Shift when held, `kc` when tapped | -|`LALT_T(kc)`|`ALT_T(kc)` |Left Alt when held, `kc` when tapped | -|`RALT_T(kc)`|`ALGR_T(kc)` |Right Alt when held, `kc` when tapped | -|`LGUI_T(kc)`|`LCMD_T(kc)`, `RWIN_T(kc)`, `GUI_T(kc)`|Left GUI when held, `kc` when tapped | -|`RGUI_T(kc)`|`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped | -|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped | -|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped| -|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped | -|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped | -|`ALL_T(kc)` | |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)| -|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped | -|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped | diff --git a/docs/modtap.md b/docs/modtap.md index f7ee5a3..1662a48 100644 --- a/docs/modtap.md +++ b/docs/modtap.md @@ -6,19 +6,25 @@ One key if you tap it, one or more modifiers if you hold it! Just copy the example from New Keycode above your keymap and change KC.SOMETHING to the key that you want when tapped. After that, just use the new keycode anywhere in your keymap. -|New Keycode | Description | -|------------------------------------------------------------------|-----------------------------------------------------------------| -|LCTL = KC.MT(KC.LCTRL, kc=KC.SOMETHING) |`LCTRL` if held `kc` if tapped | -|LSFT = KC.MT(KC.LSFT, kc=KC.SOMETHING) |`LSHIFT` if held `kc` if tapped | -|LALT = KC.MT(KC.LALT, kc=KC.SOMETHING) |`LALT` if held `kc` if tapped | -|LGUI = KC.MT(KC.LGUI, kc=KC.SOMETHING) |`LGUI` if held `kc` if tapped | -|RCTL = KC.MT(KC.RCTRL, kc=KC.SOMETHING) |`RCTRL` if held `kc` if tapped | -|RSFT = KC.MT(KC.RSFT, kc=KC.SOMETHING) |`RSHIFT` if held `kc` if tapped | -|RALT = KC.MT(KC.RALT, kc=KC.SOMETHING) |`RALT` if held `kc` if tapped | -|RGUI = KC.MT(KC.RGUI, kc=KC.SOMETHING) |`RGUI` if held `kc` if tapped | -|SGUI = KC.MT(KC.LSHFT, KC.LGUI, kc=KC.SOMETHING) |`LSHIFT` and `LGUI` if held `kc` if tapped | -|LCA = KC.MT(KC.LCTRL, KC.LALT, kc=KC.SOMETHING) |`LCTRL` and `LALT` if held `kc` if tapped | -|LCAG = KC.MT(KC.LCTRL, KC.LALT, KC.LGUI, kc=KC.SOMETHING) |`LCTRL` and `LALT` and `LGUI` if held `kc` if tapped | -|MEH = KC.MT(KC.LCTRL, KC.LSFT, KC.LALT, kc=KC.SOMETHING) |`CTRL` and `LSHIFT` and `LALT` if held `kc` if tapped | -|HYPR = KC.MT(KC.LCTRL, KC.LSFT, KC.LALT, KC.LGUI, kc=KC.SOMETHING)|`LCTRL` and `LSHIFT` and `LALT` and `LGUI` if held `kc` if tapped| +|New Keycode | Description | +|---------------------------------------------------------------|-----------------------------------------------------------------| +|LCTL = KC.MT(KC.SOMETHING, KC.LCTRL) |`LCTRL` if held `kc` if tapped | +|LSFT = KC.MT(KC.SOMETHING, KC.LSFT) |`LSHIFT` if held `kc` if tapped | +|LALT = KC.MT(KC.SOMETHING, KC.LALT) |`LALT` if held `kc` if tapped | +|LGUI = KC.MT(KC.SOMETHING, KC.LGUI) |`LGUI` if held `kc` if tapped | +|RCTL = KC.MT(KC.SOMETHING, KC.RCTRL) |`RCTRL` if held `kc` if tapped | +|RSFT = KC.MT(KC.SOMETHING, KC.RSFT) |`RSHIFT` if held `kc` if tapped | +|RALT = KC.MT(KC.SOMETHING, KC.RALT) |`RALT` if held `kc` if tapped | +|RGUI = KC.MT(KC.SOMETHING, KC.RGUI) |`RGUI` if held `kc` if tapped | +|SGUI = KC.MT(KC.SOMETHING, KC.LSHFT, KC.LGUI) |`LSHIFT` and `LGUI` if held `kc` if tapped | +|LCA = KC.MT(KC.SOMETHING, KC.LCTRL, KC.LALT) |`LCTRL` and `LALT` if held `kc` if tapped | +|LCAG = KC.MT(KC.SOMETHING, KC.LCTRL, KC.LALT, KC.LGUI) |`LCTRL` and `LALT` and `LGUI` if held `kc` if tapped | +|MEH = KC.MT(KC.SOMETHING, KC.LCTRL, KC.LSFT, KC.LALT) |`CTRL` and `LSHIFT` and `LALT` if held `kc` if tapped | +|HYPR = KC.MT(KC.SOMETHING, KC.LCTRL, KC.LSFT, KC.LALT, KC.LGUI)|`LCTRL` and `LSHIFT` and `LALT` and `LGUI` if held `kc` if tapped| + +```python +SHFT_HOME = KC.MT(KC.HOME, KC.LSFT) + +keyboard.keymap = [[ ...., SHFT_HOME, ....], ....] +``` diff --git a/kmk/keys.py b/kmk/keys.py index 3a757ec..bc021ee 100644 --- a/kmk/keys.py +++ b/kmk/keys.py @@ -679,11 +679,11 @@ make_argumented_key( ) -def mod_tap_validator(mod1, mod2=None, mod3=None, mod4=None, kc=None): +def mod_tap_validator(kc, mod1=None, mod2=None, mod3=None, mod4=None): ''' Validates that mod tap keys are correctly used ''' - return ModTapKeyMeta(mod1=mod1, mod2=mod2, mod3=mod3, mod4=mod4, kc=kc) + return ModTapKeyMeta(kc=kc, mod1=mod1, mod2=mod2, mod3=mod3, mod4=mod4) # ModTap diff --git a/kmk/types.py b/kmk/types.py index 80a3c3b..6276cdf 100644 --- a/kmk/types.py +++ b/kmk/types.py @@ -33,7 +33,7 @@ class LayerKeyMeta: class ModTapKeyMeta: - def __init__(self, mod1=None, mod2=None, mod3=None, mod4=None, kc=None): + def __init__(self, kc=None, mod1=None, mod2=None, mod3=None, mod4=None): self.mod1 = mod1 self.mod2 = mod2 self.mod3 = mod3