From 26c40b977f7f383e43915208557940716b5d2b7c Mon Sep 17 00:00:00 2001 From: Josh Klar Date: Fri, 19 Oct 2018 02:03:59 -0700 Subject: [PATCH 1/3] Update docs for leader mode --- docs/leader.md | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/docs/leader.md b/docs/leader.md index afca076..d4d3d52 100644 --- a/docs/leader.md +++ b/docs/leader.md @@ -15,32 +15,57 @@ cancel the sequence. ```python from kmk.macros.simple import simple_key_sequence -LEADER_DICTIONARY = { - (KC.T, KC.A, KC.S, KC.K): simple_key_sequence(Modifiers.KC_LCTRL(Modifiers.KC_LSHIFT(Common.KC_ESC))) +# ... + +keyboard.leader_dictionary = { + (KC.T, KC.A, KC.S, KC.K): simple_key_sequence([Modifiers.KC_LCTRL(Modifiers.KC_LSHIFT(Common.KC_ESC))]) } keymap = [...KC.LEAD,...] + +# ... ``` + +If defining tuples of keycodes is too obtuse for you, we have a convenience +function available for that, too! + +```python +from kmk.keycodes import generate_leader_dictionary_seq as glds + +# ... + +keyboard.leader_dictionary = { + glds('task'): simple_key_sequence([Modifiers.KC_LCTRL(Modifiers.KC_LSHIFT(Common.KC_ESC))]) +} + +# ... +``` + # Modes -Modes avaliable (WARNING: LeaderMode.ENTER is currently the only one avaliable.) -1. LeaderMode.DEFAULT +1. LeaderMode.TIMEOUT 2. LeaderMode.ENTER -### DEFAULT #WARNING# NOT AVALIBLE YET +### Timeout Mode Will expire after a timer and trigger the sequence that matches if any. This can be enabled with ```python -from kmk.consts.LederMode -leader_mode = LeaderMode.DEFAULT +from kmk.consts.LeaderMode +keyboard.leader_mode = LeaderMode.TIMEOUT ``` + The timeout can be set like this ```python -leader_timeout = 2000 +keyboard.leader_timeout = 2000 # in milliseconds-ish ``` -### ENTER + +The timeout defaults to `1000`, which is roughly a second. + +### Enter Mode Has no timeout. To end sequence press the enter key, or cancel and do nothing, press escape. This can be enabled with - from kmk.consts.LederMode - leader_mode = LeaderMode.ENTER +```python +from kmk.consts.LederMode +keyboard.leader_mode = LeaderMode.ENTER +``` From 74716c4c206d63419600db068291b66bf0be460e Mon Sep 17 00:00:00 2001 From: Josh Klar Date: Fri, 19 Oct 2018 02:08:13 -0700 Subject: [PATCH 2/3] More sane default leader mode --- docs/leader.md | 2 +- kmk/firmware.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/leader.md b/docs/leader.md index d4d3d52..7eb1753 100644 --- a/docs/leader.md +++ b/docs/leader.md @@ -42,7 +42,7 @@ keyboard.leader_dictionary = { ``` # Modes -1. LeaderMode.TIMEOUT +1. LeaderMode.TIMEOUT (the default) 2. LeaderMode.ENTER ### Timeout Mode diff --git a/kmk/firmware.py b/kmk/firmware.py index 3b479dc..389321d 100644 --- a/kmk/firmware.py +++ b/kmk/firmware.py @@ -53,7 +53,7 @@ class Firmware: unicode_mode = UnicodeModes.NOOP tap_time = 300 - leader_mode = LeaderMode.ENTER + leader_mode = LeaderMode.TIMEOUT leader_dictionary = {} leader_timeout = 1000 From 1521a3ec035c8cc5664379d0f64b28e97cf6dec2 Mon Sep 17 00:00:00 2001 From: Josh Klar Date: Fri, 19 Oct 2018 02:09:10 -0700 Subject: [PATCH 3/3] Fix more typoes --- docs/leader.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/leader.md b/docs/leader.md index 7eb1753..732ef1e 100644 --- a/docs/leader.md +++ b/docs/leader.md @@ -49,7 +49,7 @@ keyboard.leader_dictionary = { Will expire after a timer and trigger the sequence that matches if any. This can be enabled with ```python -from kmk.consts.LeaderMode +from kmk.consts import LeaderMode keyboard.leader_mode = LeaderMode.TIMEOUT ``` @@ -65,7 +65,6 @@ Has no timeout. To end sequence press the enter key, or cancel and do nothing, p This can be enabled with ```python -from kmk.consts.LederMode +from kmk.consts import LeaderMode keyboard.leader_mode = LeaderMode.ENTER ``` -