Skip to content

Commit

Permalink
Add magic repeat/shift
Browse files Browse the repository at this point in the history
  • Loading branch information
urob committed Jan 22, 2025
1 parent 18720e9 commit 9bf774b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 51 deletions.
27 changes: 19 additions & 8 deletions config/base.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,24 @@ ZMK_HOLD_TAP(mt_end, bindings = <&masked_end>, <&kp>; MT_CORE)
MASK_MODS(masked_home, (MOD_LCTL), &kp HOME)
MASK_MODS(masked_end, (MOD_LCTL), &kp END)

/* Caps-word & auto-layers */

// Tap: sticky-shift | Shift + tap/ double-tap: caps-word | Hold: shift.
ZMK_MOD_MORPH(smart_shft,
bindings = <&sk LSHFT>, <&caps_word>;
mods = <(MOD_LSFT)>;
)
/* Magic-shift & auto-layers */

// Tap: repeat after alpha, else sticky-shift |
// Shift + tap/ double-tap: caps-word | Hold: shift.
#define MAGIC_SHIFT &magic_shift LSHFT 0
ZMK_HOLD_TAP(magic_shift, bindings = <&kp>, <&magic_shift_tap>;
flavor = "balanced"; tapping-term-ms = <200>;
quick-tap-ms = <QUICK_TAP_MS>;)
ZMK_MOD_MORPH(magic_shift_tap, bindings = <&shift_repeat>, <&caps_word>;
mods = <(MOD_LSFT)>;)
ZMK_ADAPTIVE_KEY(
shift_repeat, bindings = <&sk LSHFT>;
repeat {
trigger-keys = <A B C D E F G H I J K L M N O P Q R S T U V W X Y Z>;
bindings = <&key_repeat>;
max-prior-idle-ms = <1200>;
strict-modifiers;
};)
&caps_word { // Mods deactivate caps-word, requires PR #1451. [TODO: rebase]
/delete-property/ ignore-modifiers;
};
Expand Down Expand Up @@ -196,7 +207,7 @@ ZMK_BASE_LAYER(Base,
//├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
&kp Z &kp X &kp C &kp D &kp V , &kp K &kp H &comma_morph &dot_morph &qexcl ,
//╰─────────────┼─────────────┴─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┴───────────────────────────╯
&lt_spc NAV 0 &lt FN RET , SMART_NUM &smart_shft
&lt_spc NAV 0 &lt FN RET , SMART_NUM MAGIC_SHIFT
// ╰─────────────┴─────────────╯ ╰─────────────┴─────────────╯
)

Expand Down
65 changes: 30 additions & 35 deletions draw/base.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions draw/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ parse_config:
"&kp LS(TAB)": Prev Win
"&dot_spc": Sentence
"&num_dance": { "t": "Numword", "s": "Sticky Num" }
"&magic": Repeat / Smart Shift
"&magic_shift": { "t": Magic, "h": "Shift" }
"&smart_mouse": Smart Mouse
# "&smart_num": Smart Num
# "&smart_shft": Smart Shift

"&hml LS(LALT)TAB": Tab
"&hm_combo_ldr": Leader
Expand Down
Binary file modified draw/keymap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 8 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ The state of the entire firmware is pinned in my `west`
- ["Timeless" homerow mods](#timeless-homerow-mods)
- Combos instead of symbol layer
- Auto-toggle off numbers and mouse layers
- Magic thumb quadrupling as Repeat/Sticky-shift/Capsword/Shift
- Leader key sequences for Unicode input and system commands
- Arrow-cluster doubles as <kbd>home</kbd>, <kbd>end</kbd>, <kbd>begin/end of
document</kbd> on long-press
- Shifted actions that make sense: <kbd>, ↦ ;</kbd>, <kbd>. ↦ :</kbd> and <kbd>?
↦ !</kbd>
- Simpler Devicetree syntax using helper macros from
[zmk-helpers](https://github.com/urob/zmk-helpers)
- Fully automated, nix-based [local build environment](#local-build-environment)
- Fully automated, nix-powered [local build environment](#local-build-environment)

![](draw/keymap.png)
([Click here](https://raw.githubusercontent.com/urob/zmk-config/refs/heads/main/draw/base.svg)
Expand Down Expand Up @@ -202,11 +203,13 @@ Similarly to Numword, I have a smart-mouse layer (activated by comboing
and mouse-movements, and replaces the right thumbs with mouse buttons. Pressing
any other key automatically deactivates the layer.

##### Capsword
##### Magic Repeat/Shift/Capsword

My right thumb triggers three variations of shift: Tapping yields sticky-shift
(used to capitalize alphas), holding activates a regular shift, and
double-tapping (or equivalently shift + tap) activates ZMK's Caps-word behavior.
My right thumb triggers three variations of shift as well as repeat: Tapping
after any alpha key yields key-repeat (to reduce SFUs). Tapping after any other
keycode yields sticky-shift (used to capitalize alphas). Holding activates a
regular shift, and double-tapping (or equivalently shift + tap) activates ZMK's
Caps-word behavior.

One minor technical detail: While it would be possible to implement the
double-tap functionality as a tap-dance, this would add a delay when using
Expand Down

0 comments on commit 9bf774b

Please sign in to comment.