Skip to content

Commit

Permalink
add zmk-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-cal committed Nov 8, 2024
1 parent 3bf813d commit 8d5d409
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[submodule "config/config/zmk-helpers-repo"]
path = config/config/zmk-helpers-repo
url = https://github.com/urob/zmk-helpers
branch = v2
[submodule "config/zmk-helpers-repo"]
path = config/zmk-helpers-repo
url = https://github.com/urob/zmk-helpers
branch = v2
66 changes: 66 additions & 0 deletions config/combos.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* KEY POSITIONS

╭─────────────────────╮ ╭─────────────────────╮
│ LT4 LT3 LT2 LT1 LT0 │ │ RT0 RT1 RT2 RT3 RT4 │
│ LM4 LM3 LM2 LM1 LM0 │ │ RM0 RM1 RM2 RM3 RM4 │
│ LB4 LB3 LB2 LB1 LB0 │ │ RB0 RB1 RB2 RB3 RB4 │
╰───────╮ LH2 LH1 LH0 │ │ RH0 RH1 RH2 ╭───────╯
╰─────────────╯ ╰─────────────╯ */

#define COMBO_TERM_FAST 18
#define COMBO_TERM_SLOW 30

#define COMBO_IDLE_FAST 150
#define COMBO_IDLE_SLOW 50

/* Horizontal combos - left hand */
ZMK_COMBO(esc, &kp ESC, LT3 LT2, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(ret, &kp RETURN, LT2 LT1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(mouse, &smart_mouse, LT3 LT1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)

// Combos overlapping HRMs are set up as hold-taps themselves to allow for instantaneous
// chording of mods. Custom hold-tap instances can be bootstrapped on the go using the
// 8-argument version of ZMK_COMBO defined in base.keymap.
ZMK_COMBO(tab, &hml LS(LALT)TAB, LM3 LM2, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(ldr, &leader, LM2 LM1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST, LS(LCTRL), KEYS_R)
ZMK_COMBO(ldrsh, &leader_sft, LM3 LM2 LM1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST, LS(LC(LALT)), KEYS_R)

ZMK_COMBO(cut, &kp LC(X), LB3 LB1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(copy, &kp LC(INS), LB3 LB2, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(paste, &kp LS(INS), LB2 LB1, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)

/* Horizontal combos - right hand */
ZMK_COMBO(bspc, &kp BSPC, RT1 RT2, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(del, &kp DEL, RT2 RT3, DEF NAV NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)

ZMK_COMBO(lpar, &lpar_lt, RM1 RM2, DEF NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST, RS(LCTRL), KEYS_L)
ZMK_COMBO(rpar, &rpar_gt, RM2 RM3, DEF NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST, RS(LALT), KEYS_L)
ZMK_COMBO(lt, &kp LT, RM1 RM2, NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(gt, &kp GT, RM2 RM3, NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)

ZMK_COMBO(lbkt, &kp LBKT, RB1 RB2, DEF NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(rbkt, &kp RBKT, RB2 RB3, DEF NUM, COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(lbrc, &kp LBRC, RB1 RB2, NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)
ZMK_COMBO(rbrc, &kp RBRC, RB2 RB3, NAV , COMBO_TERM_FAST, COMBO_IDLE_FAST)

/* Vertical combos - left hand */
ZMK_COMBO(at, &kp AT, LT3 LM3, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(hash, &kp HASH, LT2 LM2, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(dllr, &kp DLLR, LT1 LM1, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(prcnt, &kp PRCNT, LT0 LM0, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)

ZMK_COMBO(grave, &kp GRAVE, LM3 LB3, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(bslh, &kp BSLH, LM2 LB2, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(equal, &kp EQUAL, LM1 LB1, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(tilde, &kp TILDE, LM0 LB0, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)

/* Vertical combos - right hand */
ZMK_COMBO(caret, &kp CARET, RT0 RM0, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(plus, &kp PLUS, RT1 RM1, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(star, &kp STAR, RT2 RM2, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(amps, &kp AMPS, RT3 RM3, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)

ZMK_COMBO(under, &kp UNDER, RM0 RB0, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(minus, &kp MINUS, RM1 RB1, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(fslh, &kp FSLH, RM2 RB2, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
ZMK_COMBO(pipe, &kp PIPE, RM3 RB3, DEF NAV NUM, COMBO_TERM_SLOW, COMBO_IDLE_SLOW)
31 changes: 19 additions & 12 deletions config/corne.keymap
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <behaviors.dtsi>

#include "zmk-helpers/helper.h"
#include "zmk-helpers/key-labels/36.h"

#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>

// HRM combo hack - workaround for lack of tap-only combos (ZMK issue #544)
#define ZMK_COMBO_8(NAME, TAP, KEYPOS, LAYERS, COMBO_TERM, COMBO_IDLE, HOLD, SIDE) \
MAKE_HRM(hm_combo_ ## NAME, &kp, TAP, SIDE THUMBS) \
ZMK_COMBO_6(NAME, &hm_combo_ ## NAME HOLD 0, KEYPOS, LAYERS, COMBO_TERM, COMBO_IDLE)

/* Combos, leader key sequences, mouse emulation */

#include "combos.dtsi" // must be sources after HRM-combo hack

#define DEFAULT 0

/ {
Expand All @@ -24,14 +31,14 @@
default_layer {
bindings = <
// ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮
// │ Q │ W │ ERT │ │ YUIOP
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
// │ Q │ W │ FPB │ │ JLUY;:
&kp Q &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &kp SEMI
// ├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
// │ A │ SDF │ G │ │ HJKL:;
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI
// │ A │ RST │ G │ │ MNEI O
&kp A &kp R &kp S &kp T &kp G &kp M &kp N &kp E &kp I &kp O
// ├──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────┤
// │ ZXC │ V │ B │ │ NM<,>. │ /? │
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp PERIOD &kp QMARK
// │ XCD │ V │ Z │ │ KH,<.> │ /? │
&kp X &kp C &kp D &kp V &kp Z &kp K &kp H &kp COMMA &kp PERIOD &kp QMARK
// ╰──────────┼──────────┼──────────┼──────────┼──────────┤ ├──────────┼──────────┼──────────┼──────────┼──────────╯
&kp LGUI &kp LALT &kp SPACE &kp BSPC &kp DEL &kp RET
// ╰────────────────────────────────╯ ╰────────────────────────────────╯
Expand Down
5 changes: 5 additions & 0 deletions config/west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ manifest:
remotes:
- name: zmkfirmware
url-base: https://github.com/zmkfirmware
- name: urob
url-base: https://github.com/urob
projects:
- name: zmk
remote: zmkfirmware
revision: main
import: app/west.yml
- name: zmk-helpers
remote: urob
revision: main
self:
path: config
1 change: 1 addition & 0 deletions config/zmk-helpers
1 change: 1 addition & 0 deletions config/zmk-helpers-repo
Submodule zmk-helpers-repo added at a98b7f

0 comments on commit 8d5d409

Please sign in to comment.