From 692a9d902574f5b666c19ed8139d04c766b1b9dd Mon Sep 17 00:00:00 2001 From: Manna Harbour <51143715+manna-harbour@users.noreply.github.com> Date: Fri, 18 Nov 2022 12:01:31 +1100 Subject: [PATCH] Add MIRYOKU_KLUDGE_GLOBALSHIFTFUNCTIONS --- miryoku/miryoku.h | 2 ++ .../miryoku_layer_alternatives.h | 20 +++++++++---------- miryoku/miryoku_shift_functions.dtsi | 8 +++++--- miryoku/miryoku_shift_functions.h | 20 +++++++++++++++++++ readme.org | 15 +++++++++++--- 5 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 miryoku/miryoku_shift_functions.h diff --git a/miryoku/miryoku.h b/miryoku/miryoku.h index 40c03e2..ecbd6ca 100644 --- a/miryoku/miryoku.h +++ b/miryoku/miryoku.h @@ -19,6 +19,8 @@ #include "miryoku_double_tap_guard.h" +#include "miryoku_shift_functions.h" + #if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR) #include "miryoku_kludge_mousekeyspr.h" #else diff --git a/miryoku/miryoku_babel/miryoku_layer_alternatives.h b/miryoku/miryoku_babel/miryoku_layer_alternatives.h index 618c798..d021062 100644 --- a/miryoku/miryoku_babel/miryoku_layer_alternatives.h +++ b/miryoku/miryoku_babel/miryoku_layer_alternatives.h @@ -311,32 +311,32 @@ U_NP, U_NP, U_NA, U_NA, U_NA #define MIRYOKU_ALTERNATIVES_MEDIA_INVERTEDT_FLIP \ -&u_rgb_hui, &u_rgb_sai, &kp C_VOL_UP, &u_rgb_bri, &u_rgb_tog, U_NA, &u_to_U_BASE, &u_to_U_EXTRA, &u_to_U_TAP, U_BOOT, \ -&u_rgb_eff, &kp C_PREV, &kp C_VOL_DN, &kp C_NEXT, &u_ep_tog, U_NA, &kp LSHFT, &kp LCTRL, &kp LALT, &kp LGUI, \ +U_RGB_HUI, U_RGB_SAI, &kp C_VOL_UP, U_RGB_BRI, U_RGB_TOG, U_NA, &u_to_U_BASE, &u_to_U_EXTRA, &u_to_U_TAP, U_BOOT, \ +U_RGB_EFF, &kp C_PREV, &kp C_VOL_DN, &kp C_NEXT, U_EP_TOG, U_NA, &kp LSHFT, &kp LCTRL, &kp LALT, &kp LGUI, \ &u_bt_sel_0, &u_bt_sel_1, &u_bt_sel_2, &u_bt_sel_3, &u_out_tog, U_NA, &u_to_U_MEDIA, &u_to_U_FUN, &kp RALT, U_NA, \ U_NP, U_NP, &kp C_MUTE, &kp C_PP, &kp C_STOP, U_NA, U_NA, U_NA, U_NP, U_NP #define MIRYOKU_ALTERNATIVES_MEDIA_FLIP \ -&u_rgb_eff, &u_rgb_hui, &u_rgb_sai, &u_rgb_bri, &u_rgb_tog, U_NA, &u_to_U_BASE, &u_to_U_EXTRA, &u_to_U_TAP, U_BOOT, \ -&kp C_PREV, &kp C_VOL_DN, &kp C_VOL_UP, &kp C_NEXT, &u_ep_tog, U_NA, &kp LSHFT, &kp LCTRL, &kp LALT, &kp LGUI, \ +U_RGB_EFF, U_RGB_HUI, U_RGB_SAI, U_RGB_BRI, U_RGB_TOG, U_NA, &u_to_U_BASE, &u_to_U_EXTRA, &u_to_U_TAP, U_BOOT, \ +&kp C_PREV, &kp C_VOL_DN, &kp C_VOL_UP, &kp C_NEXT, U_EP_TOG, U_NA, &kp LSHFT, &kp LCTRL, &kp LALT, &kp LGUI, \ &u_bt_sel_0, &u_bt_sel_1, &u_bt_sel_2, &u_bt_sel_3, &u_out_tog, U_NA, &u_to_U_MEDIA, &u_to_U_FUN, &kp RALT, U_NA, \ U_NP, U_NP, &kp C_MUTE, &kp C_PP, &kp C_STOP, U_NA, U_NA, U_NA, U_NP, U_NP #define MIRYOKU_ALTERNATIVES_MEDIA_INVERTEDT \ -U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, &u_rgb_tog, &u_rgb_eff, &kp C_VOL_UP, &u_rgb_hui, &u_rgb_sai, \ -&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, &u_ep_tog, &kp C_PREV, &kp C_VOL_DN, &kp C_NEXT, &u_rgb_bri, \ +U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, U_RGB_TOG, U_RGB_EFF, &kp C_VOL_UP, U_RGB_HUI, U_RGB_SAI, \ +&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, U_EP_TOG, &kp C_PREV, &kp C_VOL_DN, &kp C_NEXT, U_RGB_BRI, \ U_NA, &kp RALT, &u_to_U_FUN, &u_to_U_MEDIA, U_NA, &u_out_tog, &u_bt_sel_0, &u_bt_sel_1, &u_bt_sel_2, &u_bt_sel_3, \ U_NP, U_NP, U_NA, U_NA, U_NA, &kp C_STOP, &kp C_PP, &kp C_MUTE, U_NP, U_NP #define MIRYOKU_ALTERNATIVES_MEDIA_VI \ -U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, &u_rgb_eff, &u_rgb_hui, &u_rgb_sai, &u_rgb_bri, &u_rgb_tog, \ -&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, &kp C_PREV, &kp C_VOL_DN, &kp C_VOL_UP, &kp C_NEXT, &u_ep_tog, \ +U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, U_RGB_EFF, U_RGB_HUI, U_RGB_SAI, U_RGB_BRI, U_RGB_TOG, \ +&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, &kp C_PREV, &kp C_VOL_DN, &kp C_VOL_UP, &kp C_NEXT, U_EP_TOG, \ U_NA, &kp RALT, &u_to_U_FUN, &u_to_U_MEDIA, U_NA, &u_bt_sel_0, &u_bt_sel_1, &u_bt_sel_2, &u_bt_sel_3, &u_out_tog, \ U_NP, U_NP, U_NA, U_NA, U_NA, &kp C_STOP, &kp C_PP, &kp C_MUTE, U_NP, U_NP #define MIRYOKU_ALTERNATIVES_MEDIA \ -U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, &u_rgb_tog, &u_rgb_eff, &u_rgb_hui, &u_rgb_sai, &u_rgb_bri, \ -&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, &u_ep_tog, &kp C_PREV, &kp C_VOL_DN, &kp C_VOL_UP, &kp C_NEXT, \ +U_BOOT, &u_to_U_TAP, &u_to_U_EXTRA, &u_to_U_BASE, U_NA, U_RGB_TOG, U_RGB_EFF, U_RGB_HUI, U_RGB_SAI, U_RGB_BRI, \ +&kp LGUI, &kp LALT, &kp LCTRL, &kp LSHFT, U_NA, U_EP_TOG, &kp C_PREV, &kp C_VOL_DN, &kp C_VOL_UP, &kp C_NEXT, \ U_NA, &kp RALT, &u_to_U_FUN, &u_to_U_MEDIA, U_NA, &u_out_tog, &u_bt_sel_0, &u_bt_sel_1, &u_bt_sel_2, &u_bt_sel_3, \ U_NP, U_NP, U_NA, U_NA, U_NA, &kp C_STOP, &kp C_PP, &kp C_MUTE, U_NP, U_NP diff --git a/miryoku/miryoku_shift_functions.dtsi b/miryoku/miryoku_shift_functions.dtsi index 80334c8..829504e 100644 --- a/miryoku/miryoku_shift_functions.dtsi +++ b/miryoku/miryoku_shift_functions.dtsi @@ -22,7 +22,6 @@ }; \ MIRYOKU_SHIFT_FUNCTION(NAME, BINDING, &u_macro_ ## NAME) - MIRYOKU_SHIFT_MACRO(u_bt_sel_0, &bt BT_SEL 0, &bt BT_SEL 0 &bt BT_CLR) MIRYOKU_SHIFT_MACRO(u_bt_sel_1, &bt BT_SEL 1, &bt BT_SEL 1 &bt BT_CLR) MIRYOKU_SHIFT_MACRO(u_bt_sel_2, &bt BT_SEL 2, &bt BT_SEL 2 &bt BT_CLR) @@ -31,6 +30,10 @@ MIRYOKU_SHIFT_MACRO(u_bt_sel_4, &bt BT_SEL 4, &bt BT_SEL 4 &bt BT_CLR) MIRYOKU_SHIFT_FUNCTION(u_out_tog, &out OUT_TOG, &out OUT_USB) +MIRYOKU_SHIFT_FUNCTION(u_caps_word, &caps_word, &kp CAPS) + +#if defined (MIRYOKU_KLUDGE_GLOBALSHIFTFUNCTIONS) + MIRYOKU_SHIFT_FUNCTION(u_rgb_tog, &rgb_ug RGB_TOG, &rgb_ug RGB_OFF) MIRYOKU_SHIFT_FUNCTION(u_rgb_eff, &rgb_ug RGB_EFF, &rgb_ug RGB_EFR) @@ -40,5 +43,4 @@ MIRYOKU_SHIFT_FUNCTION(u_rgb_bri, &rgb_ug RGB_BRI, &rgb_ug RGB_BRD) MIRYOKU_SHIFT_FUNCTION(u_ep_tog, &ext_power EP_TOG, &ext_power EP_OFF) -MIRYOKU_SHIFT_FUNCTION(u_caps_word, &caps_word, &kp CAPS) - +#endif diff --git a/miryoku/miryoku_shift_functions.h b/miryoku/miryoku_shift_functions.h new file mode 100644 index 0000000..fe61dd5 --- /dev/null +++ b/miryoku/miryoku_shift_functions.h @@ -0,0 +1,20 @@ +// Copyright 2022 Manna Harbour +// https://github.com/manna-harbour/miryoku + +#pragma once + +#if defined (MIRYOKU_KLUDGE_GLOBALSHIFTFUNCTIONS) + #define U_RGB_TOG &u_rgb_tog + #define U_RGB_EFF &u_rgb_eff + #define U_RGB_HUI &u_rgb_hui + #define U_RGB_SAI &u_rgb_sai + #define U_RGB_BRI &u_rgb_bri + #define U_EP_TOG &u_ep_tog +#else + #define U_RGB_TOG &rgb_ug RGB_TOG + #define U_RGB_EFF &rgb_ug RGB_EFF + #define U_RGB_HUI &rgb_ug RGB_HUI + #define U_RGB_SAI &rgb_ug RGB_SAI + #define U_RGB_BRI &rgb_ug RGB_BRI + #define U_EP_TOG &ext_power EP_TOG +#endif diff --git a/readme.org b/readme.org index a17ef4d..5d91ab0 100644 --- a/readme.org +++ b/readme.org @@ -23,6 +23,7 @@ The [[#keyboard-keymaps][keyboard keymaps]] are composed of the config file, a [ [[#caps-word][caps word]], [[#customisation][customisation]], [[#double-tap-boot][double tap boot]], +[[#global-shift-functions][global shift functions]], [[#key-emulation-combos][key emulation combos]], [[#mouse-keys][mouse keys]], [[#suspend][suspend]], @@ -443,13 +444,21 @@ See https://github.com/manna-harbour/miryoku/discussions/85. *** Double Tap Boot -[[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#additional-features][Additional features]] require a double tap to prevent accidental activation. This not supported in ZMK for the bootloader behavior on split keyboards. Use a single tap instead. See https://github.com/zmkfirmware/zmk/issues/1494. +Double tap is used with [[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#additional-features][Additional features]]. Double tap for the bootloader behavior is not supported in ZMK on split keyboards. See https://github.com/zmkfirmware/zmk/issues/1494. By default, double tap for bootloader is disabled. Use a single tap instead. -Requiring double tap to activate the bootloader can be enabled for use with non-split keyboards. Use with split keyboards will require use of the reset button to enter the bootloader on the peripheral side. +Double tap for bootloader can be enabled for use with non-split keyboards. For [[#local-builds][local builds]], add ~#define MIRYOKU_KLUDGE_DOUBLETAPBOOT~ to the [[#config-file][config file]]. For [[#workflow-builds][workflow builds]], use ~#define MIRYOKU_KLUDGE_DOUBLETAPBOOT~ with the ~custom_config~ option. -For [[#local-builds][local builds]], add ~#define MIRYOKU_KLUDGE_DOUBLETAPBOOT~ to the [[#config-file][config file]]. For [[#workflow-builds][workflow builds]], use ~#define MIRYOKU_KLUDGE_DOUBLETAPBOOT~ with the ~custom_config~ option. +Use with split keyboards will result in the bootloader function only taking effect on the central side. Use a reset button to enter the bootloader on the peripheral side. +*** Global Shift Functions + +Shift functions are used on [[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#media][Media]]. Shift functions are not supported in ZMK for RGB and EP behaviors on split keyboards. See https://github.com/zmkfirmware/zmk/issues/1494. By default, shift functions for RGB and EP are disabled. Only the unshifted functions are available. + +Shift functions for RGB and EP can be enabled for use with non-split keyboards. For [[#local-builds][local builds]], add ~#define MIRYOKU_KLUDGE_GLOBALSHIFTFUNCTIONS~ to the [[#config-file][config file]]. For [[#workflow-builds][workflow builds]], use ~#define MIRYOKU_KLUDGE_GLOBALSHIFTFUNCTIONS~ with the ~custom_config~ option. + +Use with split keyboards will result in the shifted as well as the unshifted functions for RGB and EP only taking effect on the central side. + *** Key Emulation Combos Emulate a key with a combo of two other keys. Enabled automatically on keyboards with a missing key. Can be enabled on other keyboards for use with hard to reach keys, or for compatibility.