zmk/config/urchin.keymap

210 lines
6.1 KiB
Plaintext
Raw Permalink Normal View History

2024-09-22 20:41:51 -07:00
/*
* Copyright (c) 2020 duckyb
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
2024-09-29 00:50:01 -07:00
#include "zmk-helpers/helper.h"
#include "zmk-helpers/key-labels/42.h"
#include <dt-bindings/zmk/keys.h>
#define QUICK_TAP_MS 175
2024-09-22 20:41:51 -07:00
// Layer definitions
#define BASE 0
#define NUM 1
#define SYM 2
#define NAV 3
#define FNC 4
#define SETTINGS 5
2024-09-29 00:50:01 -07:00
/* Homerow mods */
#define HM_TAPPING_TERM 300
#define HM_TAPPING_TERM_FAST 200
#define HM_PRIOR_IDLE 150
#define KEYS_L LT0 LT1 LT2 LT3 LT4 LM0 LM1 LM2 LM3 LM4 LB0 LB1 LB2 LB3 LB4 // left hand
#define KEYS_R RT0 RT1 RT2 RT3 RT4 RM0 RM1 RM2 RM3 RM4 RB0 RB1 RB2 RB3 RB4 // right hand
#define KEYS_T LH1 LH0 RH0 RH1 // thumbs on 34 keys
2024-09-22 20:41:51 -07:00
// -----------------
&sk {
// don't release mods on other mods presses
ignore-modifiers;
};
2024-09-29 00:50:01 -07:00
&mt { // mode-tap config
2024-09-22 23:25:23 -07:00
flavor = "tap-preferred";
tapping_term_ms = <200>;
quick_tap_ms = <75>;
};
2024-09-29 00:50:01 -07:00
&lt { // layer-tap config
flavor = "balanced";
tapping-term-ms = <200>;
quick-tap-ms = <QUICK_TAP_MS>;
};
2024-09-22 23:25:23 -07:00
2024-09-22 20:41:51 -07:00
/ {
behaviors {
2024-09-29 00:50:01 -07:00
// Positional Homerow mods
// Homerow mods that prevent accidental activations when rolling keys,
// such as when typing `st` or `ne` on colemak-dh layouts or `as` on
// qwerty.
//
// Works by only allowing a mod to activate within tapping-term if
// it's on the opposite side of the keyboard or on the same side thumb
// keys.
// Further optimization using urob's timerless homerow mods method:
// https://github.com/urob/zmk-config#timeless-homerow-mods
hml: homerow_mods_left {
compatible = "zmk,behavior-hold-tap";
#binding-cells = <2>;
bindings = <&kp>, <&kp>;
flavor = "balanced";
tapping-term-ms = <HM_TAPPING_TERM>;
quick-tap-ms = <175>; // repeat on tap-into-hold
require-prior-idle-ms = <HM_PRIOR_IDLE>;
hold-trigger-key-positions = <KEYS_R KEYS_T>;
hold-trigger-on-release;
};
hmr: homerow_mods_right {
compatible = "zmk,behavior-hold-tap";
#binding-cells = <2>;
bindings = <&kp>, <&kp>;
flavor = "balanced";
tapping-term-ms = <HM_TAPPING_TERM>;
quick-tap-ms = <175>;
require-prior-idle-ms = <HM_PRIOR_IDLE>;
hold-trigger-key-positions = <KEYS_L KEYS_T>;
hold-trigger-on-release;
};
2024-09-22 20:41:51 -07:00
// Enables holding the first mod-tap key
// by performing a tap-release-hold sequence.
// To use it: "&qt KEYCODE1 KEYCODE2"
qt: quick_tap {
compatible = "zmk,behavior-hold-tap";
label = "QUICK_TAP";
#binding-cells = <2>;
flavor = "hold-preferred";
tapping-term-ms = <200>;
quick-tap-ms = <200>;
bindings = <&kp>, <&kp>;
};
};
macros {
// sometimes my device thinks a modifier is being held down
// pressing all modifiers fixes it.
unstick: unstick {
label = "ZM_unstick";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings = <&kp LSHIFT &kp RSHIFT &kp LCTRL &kp RCTRL &kp LALT &kp RALT &kp LGUI &kp RGUI>;
};
};
combos {
compatible = "zmk,combos";
// both right thumb keys
2024-10-05 01:02:16 -07:00
combo_esc {
timeout-ms = <200>;
key-positions = <32 33>;
bindings = <&kp ESC>;
};
2024-09-22 20:41:51 -07:00
// internal-left & external-right thumb keys
2024-09-22 23:25:23 -07:00
// both left thumb keys
combo_settings {
timeout-ms = <200>;
key-positions = <30 31>;
bindings = <&mo SETTINGS>;
};
2024-09-22 20:41:51 -07:00
};
keymap {
compatible = "zmk,keymap";
2024-09-22 23:25:23 -07:00
// Base alpha layer
default_layer {
label = "Base";
bindings = <
&kp SQT &kp COMMA &kp DOT &kp P &kp Y &kp F &kp G &kp C &kp R &kp L
2024-09-29 00:50:01 -07:00
&hml LCTRL A &hml LALT O &hml LSHIFT E &hml LGUI U &kp I &kp D &hmr RGUI H &hmr RSHIFT T &hmr RALT N &hmr RCTRL S
2024-10-05 01:02:16 -07:00
&hml LCTRL SCLN &kp Q &kp J &kp K &kp X &kp B &kp M &kp W &kp V &kp Z
&lt NUM SPC &lt SYM BSPC &lt NAV TAB &lt FNC RET
2024-09-22 23:25:23 -07:00
>;
};
// Numbers and high frequency symbols
num_layer {
label = "Num.";
bindings = <
&none &none &none &none &none &kp MINUS &kp N7 &kp N8 &kp N9 &none
&trans &trans &trans &trans &none &kp KP_PLUS &kp N4 &kp N5 &kp N6 &kp EQUAL
&none &none &none &none &none &kp N0 &kp N1 &kp N2 &kp N3 &none
&mo FNC &none &trans &trans
>;
};
// Symbols
2024-09-22 23:25:23 -07:00
sym_layer {
label = "Sym.";
bindings = <
&none &none &none &none &none &kp MINUS &kp AMPS &kp STAR &kp N9 &kp FSLH
&trans &trans &trans &trans &none &kp GRAVE &kp DLLR &kp PRCNT &kp CARET &kp QUESTION
&none &none &none &none &none &kp TILDE &kp EXCL &kp AT &kp HASH &kp BSLH
&trans &trans &trans &trans
2024-09-22 23:25:23 -07:00
>;
};
// Main modifiers and arrow keys
nav_layer {
label = "Nav.";
2024-09-22 23:25:23 -07:00
bindings = <
&none &none &none &none &none &none &none &none &none &none
&trans &trans &trans &trans &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none
&trans &trans &trans &trans
2024-09-22 23:25:23 -07:00
>;
};
// Function keys with modifiers
fnc_layer {
label = "FRow";
bindings = <
&kp EXCL &kp AT &kp UP &kp DLLR &kp PRCNT &none &none &none &none &none
&kp LPAR &kp LEFT &kp DOWN &kp RIGHT &kp RPAR &none &none &none &none &none
&kp LBKT &kp RBKT &kp HASH &kp LBRC &kp RBRC &none &none &none &none &none
&none &none &trans &trans
2024-09-22 23:25:23 -07:00
>;
};
// Used to change the keyboard's settings.
settings_layer {
label = "Sett.";
bindings = <
&bootloader &none &none &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 3 &none &unstick &none &bootloader
&none &none &none &none &bt BT_SEL 1 &bt BT_SEL 4 &none &none &none &none
&none &none &none &none &bt BT_SEL 2 &bt BT_SEL 5 &none &none &none &none
&none &none &none &none
>;
};
2024-09-22 20:41:51 -07:00
};
};
2024-09-22 23:25:23 -07:00