From 22bf1ab80ad0156aef5a23ddbddb732b66e947b0 Mon Sep 17 00:00:00 2001 From: Lukas Kucera <85391931+kucera-lukas@users.noreply.github.com> Date: Thu, 9 Mar 2023 21:10:45 +0100 Subject: [PATCH] add swapper for alt+tab and gui+tab --- miryoku/custom_config.h | 10 ++++++---- miryoku/swapper.dtsi | 33 +++++++++++++++++++++++++++++++++ miryoku/swapper.h | 6 ++++++ 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 miryoku/swapper.dtsi create mode 100644 miryoku/swapper.h diff --git a/miryoku/custom_config.h b/miryoku/custom_config.h index e14980e57..3a1efbb93 100644 --- a/miryoku/custom_config.h +++ b/miryoku/custom_config.h @@ -9,10 +9,12 @@ #include "hold_tap.h" #include "macros.h" +#include "swapper.h" #include "combos.dtsi" #include "hold_tap.dtsi" #include "macros.dtsi" +#include "swapper.dtsi" #define XXX &none @@ -43,10 +45,10 @@ U_NP, U_NP, U_LT(U_MEDIA, ESC),U_LT(U_NAV, SPC), U_LT U_NP, U_NP, &kp ESC, &kp SPACE, &kp TAB, &kp DEL, &kp BSPC, &kp RET, U_NP, U_NP #define MIRYOKU_LAYER_NAV \ -U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, &kp PG_UP, &kp HOME, U_NAV_UP, &kp END, &kp INS, \ -&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, &kp PG_DN, U_NAV_LEFT, U_NAV_DOWN, U_NAV_RIGHT, U_NP, \ -U_NA, &kp RALT, &u_to_U_SYM, &u_to_U_NAV, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ -U_NP, U_NP, U_NA, U_NA, U_NA, U_NAV_DEL, U_NAV_BSPC, &kp RET, U_NP, U_NP +U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, &kp PG_UP, &kp LS(LC(TAB)), U_NAV_UP, &kp LC(TAB), &kp LS(TAB), \ +&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, &kp PG_DN, U_NAV_LEFT, U_NAV_DOWN, U_NAV_RIGHT, U_ALT_GUI_TAB_SWAPPER, \ +U_NA, &kp RALT, &u_to_U_SYM, &u_to_U_NAV, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +U_NP, U_NP, U_NA, U_NA, U_NA, U_NAV_DEL, U_NAV_BSPC, &kp RET, U_NP, U_NP #define MIRYOKU_LAYER_SYM \ U_SINGLE_DOUBLE_TILDE, U_SINGLE_TRIPLE_BACKTICK, U_SINGLE_DOUBLE_BACKSLASH, U_SINGLE_DOUBLE_AMPERSAND, U_SINGLE_DOUBLE_PLUS, U_NA, &u_to_U_BASE, &u_to_U_EXTRA, &u_to_U_TAP, U_BOOT, \ diff --git a/miryoku/swapper.dtsi b/miryoku/swapper.dtsi new file mode 100644 index 000000000..09bd7f69c --- /dev/null +++ b/miryoku/swapper.dtsi @@ -0,0 +1,33 @@ +// Copyright 2022 Lukas Kucera +// https://github.com/kucera-lukas/miryoku + +#include +#include + +/ { + behaviors { + alt_tab_swapper: alt_tab_swapper { + compatible = "zmk,behavior-tri-state"; + label = "alt_tab_swapper"; + #binding-cells = <0>; + bindings = <&kt LALT>, <&kp TAB>, <&kt LALT>; + ignored-key-positions = <26>; + }; + + gui_tab_swapper: gui_tab_swapper { + compatible = "zmk,behavior-tri-state"; + label = "gui_tab_swapper"; + #binding-cells = <0>; + bindings = <&kt LGUI>, <&kp TAB>, <&kt LGUI>; + ignored-key-positions = <26 32>; + }; + + alt_gui_tab_swapper: alt_gui_tab_swapper { + compatible = "zmk,behavior-mod-morph"; + label = "alt_gui_tab_swapper"; + #binding-cells = <0>; + bindings = <&alt_tab_swapper>, <&gui_tab_swapper>; + mods = <(MOD_LSFT|MOD_RSFT)>; + }; + }; +}; diff --git a/miryoku/swapper.h b/miryoku/swapper.h new file mode 100644 index 000000000..20a6349d8 --- /dev/null +++ b/miryoku/swapper.h @@ -0,0 +1,6 @@ +// Copyright 2022 Lukas Kucera +// https://github.com/kucera-lukas/miryoku + +#pragma once + +#define U_ALT_GUI_TAB_SWAPPER &alt_gui_tab_swapper