forked from urob/zmk-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37334e9
commit 10860e8
Showing
30 changed files
with
2,077 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.dtsi linguist-language=C++ | ||
*.keymap linguist-language=C++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Robert U | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#include <behaviors.dtsi> | ||
#include <dt-bindings/zmk/keys.h> | ||
|
||
#include "../zmk-nodefree-config/helper.h" | ||
#include "../zmk-nodefree-config/keypos_def/keypos_36keys.h" | ||
#include "../zmk-nodefree-config/international_chars/german.dtsi" | ||
|
||
/* layer and key shortcuts */ | ||
|
||
#define ___ &trans | ||
|
||
#define DEF 0 // layer shortcuts, must match order in which they are defined below | ||
#define NAV 1 | ||
#define NUM 2 | ||
#define GER 3 | ||
|
||
/* custom behaviors */ | ||
|
||
// homerow mods | ||
ZMK_BEHAVIOR(hrm, hold_tap, | ||
flavor = "balanced"; | ||
tapping-term-ms = <280>; | ||
quick-tap-ms = <125>; | ||
bindings = <&kp>, <&kp>; | ||
) | ||
|
||
// tap: sticky shift | double tap: capsword | ||
ZMK_BEHAVIOR(ss_cw, tap_dance, | ||
tapping-term-ms = <200>; | ||
bindings = <&sk LSHFT>, <&caps_word>; | ||
) | ||
|
||
// tap: backspace | shift + tap: delete | hold: num layer | ||
ZMK_BEHAVIOR(bs_del_num, mod_morph, | ||
bindings = << NUM BSPC>, <&kp DEL>; | ||
mods = <(MOD_LSFT|MOD_RSFT)>; | ||
) | ||
|
||
// windows sleep macro | ||
ZMK_BEHAVIOR(win_sleep, macro, | ||
wait-ms = <100>; | ||
tap-ms = <5>; | ||
bindings = <&kp LG(X) &kp U &kp S>; | ||
) | ||
|
||
// euro sign | ||
ZMK_UNICODE_SINGLE(euro_sign, N2, N0, A, C) // € | ||
|
||
// replace a/o/u/s with German umlauts when NAV and NUM are held jointly | ||
ZMK_CONDITIONAL_LAYER(NAV NUM, GER) | ||
|
||
// combos | ||
#undef COMBO_TERM | ||
#define COMBO_TERM 40 // timeout of 40ms (default is 30ms if omitted) | ||
ZMK_COMBO(combo_sleep, &win_sleep, RT3 RT4, NAV) // custom sleep macro, only active on NAV layer | ||
ZMK_COMBO(combo_copy, &kp LC(C), LB2 LB3, ALL) // Ctrl + C, active on all layers | ||
ZMK_COMBO(combo_paste, &kp LC(V), LB1 LB2, ALL) // Ctrl + V, active on all layers | ||
|
||
/* keymap */ | ||
|
||
ZMK_LAYER(default_layer, | ||
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ | ||
&kp Q &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &kp SQT | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&hrm LGUI A &hrm LALT R &hrm LCTRL S &hrm LSHFT T &kp G &kp M &hrm RSHFT N &hrm LCTRL E &hrm LALT I &hrm LGUI O | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&kp Z &kp X &kp C &kp D &kp V &kp K &kp H &kp COMMA &kp DOT &kp SEMI | ||
// ╰─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&kp ESC < NAV SPACE &kp TAB &kp RET &bs_del_num &ss_cw | ||
// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ | ||
) | ||
|
||
ZMK_LAYER(nav_layer, | ||
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ | ||
___ ___ ___ ___ ___ &kp PG_UP &kp HOME &kp UP &kp END &kp INS | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&sk LGUI &sk LALT &sk LCTRL &sk LSHFT ___ &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp DEL | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
___ ___ ___ ___ ___ ___ &kp LC(X) &kp LC(INS) &kp LS(INS) ___ | ||
// ╰─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
___ ___ ___ ___ ___ ___ | ||
// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ | ||
) | ||
|
||
ZMK_LAYER(num_layer, | ||
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ | ||
&kp ESC &kp N7 &kp N8 &kp N9 &kp STAR ___ ___ ___ ___ ___ | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&kp TAB &kp N4 &kp N5 &kp N6 &kp PLUS ___ &sk RSHFT &sk LCTRL &sk LALT &sk LGUI | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&kp RET &kp N1 &kp N2 &kp N3 &kp FSLH ___ ___ ___ ___ ___ | ||
// ╰─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&kp DOT &kp N0 &kp MINUS ___ ___ ___ | ||
// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ | ||
) | ||
|
||
ZMK_LAYER(german_layer, | ||
// ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ | ||
___ ___ ___ ___ ___ ___ ___ &de_ue ___ ___ | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
&de_ae ___ &de_eszett ___ ___ ___ ___ &euro_sign ___ &de_oe | ||
// ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ | ||
// ╰─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ ├─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤ | ||
___ ___ ___ ___ ___ ___ | ||
// ╰─────────────┴─────────────┴─────────────╯ ╰─────────────┴─────────────┴─────────────╯ | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/* | ||
* helper.h | ||
* | ||
* Convenience macros simplifying ZMK's keymap configuration. | ||
* See https://github.com/urob/zmk-nodefree-config for documentation. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#define ZMK_HELPER_STRINGIFY(x) #x | ||
|
||
/* ZMK_BEHAVIOR */ | ||
|
||
#define ZMK_BEHAVIOR_CORE_caps_word compatible = "zmk,behavior-caps-word"; #binding-cells = <0> | ||
#define ZMK_BEHAVIOR_CORE_dynamic_macro compatible = "zmk,behavior-dynamic-macro"; #binding-cells = <1> | ||
#define ZMK_BEHAVIOR_CORE_hold_tap compatible = "zmk,behavior-hold-tap"; #binding-cells = <2> | ||
#define ZMK_BEHAVIOR_CORE_key_repeat compatible = "zmk,behavior-key-repeat"; #binding-cells = <0> | ||
#define ZMK_BEHAVIOR_CORE_macro compatible = "zmk,behavior-macro"; #binding-cells = <0> | ||
#define ZMK_BEHAVIOR_CORE_macro_one_param compatible = "zmk,behavior-macro-one-param"; #binding-cells = <1> | ||
#define ZMK_BEHAVIOR_CORE_macro_two_param compatible = "zmk,behavior-macro-two-param"; #binding-cells = <2> | ||
#define ZMK_BEHAVIOR_CORE_mod_morph compatible = "zmk,behavior-mod-morph"; #binding-cells = <0> | ||
#define ZMK_BEHAVIOR_CORE_sticky_key compatible = "zmk,behavior-sticky-key"; #binding-cells = <1> | ||
#define ZMK_BEHAVIOR_CORE_tap_dance compatible = "zmk,behavior-tap-dance"; #binding-cells = <0> | ||
#define ZMK_BEHAVIOR_CORE_tri_state compatible = "zmk,behavior-tri-state"; #binding-cells = <0> | ||
|
||
#define ZMK_BEHAVIOR(name, type, ...) \ | ||
/ { \ | ||
behaviors { \ | ||
name: name { \ | ||
label = ZMK_HELPER_STRINGIFY(ZB_ ## name); \ | ||
ZMK_BEHAVIOR_CORE_ ## type; \ | ||
__VA_ARGS__ \ | ||
}; \ | ||
}; \ | ||
}; | ||
|
||
/* ZMK_LAYER */ | ||
|
||
#define MACRO_CHOOSER3(_1, _2, _3, FUNC, ...) FUNC | ||
#define ZMK_LAYER(...) MACRO_CHOOSER3(__VA_ARGS__, ZMK_LAYER_3_ARGS, ZMK_LAYER_2_ARGS)(__VA_ARGS__) | ||
#define ZMK_LAYER_2_ARGS(name, layout) \ | ||
/ { \ | ||
keymap { \ | ||
compatible = "zmk,keymap"; \ | ||
layer_ ## name { \ | ||
label = ZMK_HELPER_STRINGIFY(name); \ | ||
bindings = <layout>; \ | ||
}; \ | ||
}; \ | ||
}; | ||
#define ZMK_LAYER_3_ARGS(name, layout, sensors) \ | ||
/ { \ | ||
keymap { \ | ||
compatible = "zmk,keymap"; \ | ||
layer_ ## name { \ | ||
label = ZMK_HELPER_STRINGIFY(name); \ | ||
bindings = <layout>; \ | ||
sensor-bindings = <sensors>; \ | ||
}; \ | ||
}; \ | ||
}; | ||
|
||
/* ZMK_COMBOS */ | ||
|
||
#define ALL 0xff | ||
#if !defined COMBO_TERM | ||
#define COMBO_TERM 30 | ||
#endif | ||
#if !defined COMBO_HOOK | ||
#define COMBO_HOOK | ||
#endif | ||
|
||
#define MACRO_CHOOSER5(_1, _2, _3, _4, _5, FUNC, ...) FUNC | ||
#define ZMK_COMBO(...) MACRO_CHOOSER5(__VA_ARGS__, ZMK_COMBO_5_ARGS, ZMK_COMBO_4_ARGS)(__VA_ARGS__) | ||
#define ZMK_COMBO_4_ARGS(name, combo_bindings, keypos, combo_layers) \ | ||
ZMK_COMBO_5_ARGS(name, combo_bindings, keypos, combo_layers, COMBO_TERM) | ||
#define ZMK_COMBO_5_ARGS(name, combo_bindings, keypos, combo_layers, combo_timeout) \ | ||
/ { \ | ||
combos { \ | ||
compatible = "zmk,combos"; \ | ||
combo_ ## name { \ | ||
timeout-ms = <combo_timeout>; \ | ||
bindings = <combo_bindings>; \ | ||
key-positions = <keypos>; \ | ||
layers = <combo_layers>; \ | ||
COMBO_HOOK \ | ||
}; \ | ||
}; \ | ||
}; | ||
|
||
/* ZMK_CONDITIONAL_LAYER */ | ||
|
||
#define ZMK_CONDITIONAL_LAYER(if_layers, then_layer) \ | ||
/ { \ | ||
conditional_layers { \ | ||
compatible = "zmk,conditional-layers"; \ | ||
tri_layer { \ | ||
if-layers = <if_layers>; \ | ||
then-layer = <then_layer>; \ | ||
}; \ | ||
}; \ | ||
}; | ||
|
||
/* ZMK_UNICODE */ | ||
|
||
#if !defined OS_UNICODE_LEAD | ||
#if HOST_OS == 2 | ||
#define OS_UNICODE_LEAD ¯o_press &kp LALT // macOS/Windows-Alt-Codes | ||
#elif HOST_OS == 1 | ||
#define OS_UNICODE_LEAD ¯o_tap &kp LS(LC(U)) // Linux | ||
#else | ||
#define OS_UNICODE_LEAD ¯o_tap &kp RALT &kp U // Windows + WinCompose (default) | ||
#endif | ||
#endif | ||
#if !defined OS_UNICODE_TRAIL | ||
#if HOST_OS == 2 | ||
#define OS_UNICODE_TRAIL ¯o_release &kp LALT // macOS/Windows-Alt-Codes | ||
#elif HOST_OS == 1 | ||
#define OS_UNICODE_TRAIL ¯o_tap &kp SPACE // Linux | ||
#else | ||
#define OS_UNICODE_TRAIL ¯o_tap &kp RET // Windows + WinCompose (default) | ||
#endif | ||
#endif | ||
|
||
#define UC_MACRO(name, unicode_bindings) \ | ||
/ { \ | ||
macros { \ | ||
name: name { \ | ||
compatible = "zmk,behavior-macro"; \ | ||
label = ZMK_HELPER_STRINGIFY(UC_MACRO_ ## name); \ | ||
wait-ms = <0>; \ | ||
tap-ms = <0>; \ | ||
#binding-cells = <0>; \ | ||
bindings = <OS_UNICODE_LEAD>, <¯o_tap unicode_bindings>, <OS_UNICODE_TRAIL>; \ | ||
}; \ | ||
}; \ | ||
}; | ||
|
||
#define UC_MODMORPH(name, uc_binding, shifted_uc_binding) \ | ||
/ { \ | ||
behaviors { \ | ||
name: name { \ | ||
compatible = "zmk,behavior-mod-morph"; \ | ||
label = ZMK_HELPER_STRINGIFY(UC_MORPH_ ## name); \ | ||
#binding-cells = <0>; \ | ||
bindings = <uc_binding>, <shifted_uc_binding>; \ | ||
mods = <(MOD_LSFT|MOD_RSFT)>; \ | ||
}; \ | ||
}; \ | ||
}; | ||
|
||
#define ZMK_UNICODE_SINGLE(name, L0, L1, L2, L3) \ | ||
UC_MACRO(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \ | ||
UC_MODMORPH(name, &name ## _lower, &none) | ||
|
||
#define ZMK_UNICODE_PAIR(name, L0, L1, L2, L3, U0, U1, U2, U3) \ | ||
UC_MACRO(name ## _lower, &kp L0 &kp L1 &kp L2 &kp L3) \ | ||
UC_MACRO(name ## _upper, &kp U0 &kp U1 &kp U2 &kp U3) \ | ||
UC_MODMORPH(name, &name ## _lower, &name ## _upper) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* Czech letters */ | ||
ZMK_UNICODE_PAIR(cs_ec, N0, N1, N1, B, N0, N1, N1, A) // ě/Ě | ||
ZMK_UNICODE_PAIR(cs_sc, N0, N1, N6, N1, N0, N1, N6, N0) // š/Š | ||
ZMK_UNICODE_PAIR(cs_cc, N0, N1, N0, D, N0, N1, N0, C) // č/Č | ||
ZMK_UNICODE_PAIR(cs_rc, N0, N1, N5, N9, N0, N1, N5, N8) // ř/Ř | ||
ZMK_UNICODE_PAIR(cs_zc, N0, N1, N7, E, N0, N1, N7, D) // ž/Ž | ||
ZMK_UNICODE_PAIR(cs_ya, N0, N0, F, D, N0, N0, D, D) // ý/Ý | ||
ZMK_UNICODE_PAIR(cs_aa, N0, N0, E, N1, N0, N0, C, N1) // á/Á | ||
ZMK_UNICODE_PAIR(cs_ia, N0, N0, E, D, N0, N0, C, D) // í/Í | ||
ZMK_UNICODE_PAIR(cs_ea, N0, N0, E, N9, N0, N0, C, N9) // é/É | ||
ZMK_UNICODE_PAIR(cs_oa, N0, N0, F, N3, N0, N0, D, N3) // ó/Ó | ||
ZMK_UNICODE_PAIR(cs_ur, N0, N1, N6, F, N0, N1, N6, E) // ů/Ů | ||
ZMK_UNICODE_PAIR(cs_ua, N0, N0, F, A, N0, N0, D, A) // ú/Ú | ||
ZMK_UNICODE_PAIR(cs_nc, N0, N1, N4, N8, N0, N1, N4, N7) // ň/Ň | ||
ZMK_UNICODE_PAIR(cs_dc, N0, N1, N0, F, N0, N1, N0, E) // ď/Ď | ||
ZMK_UNICODE_PAIR(cs_tc, N0, N1, N6, N5, N0, N1, N6, N4) // ť/Ť |
Oops, something went wrong.