From bf75313dc98d31d64ccb9886bebb96eccbed0985 Mon Sep 17 00:00:00 2001 From: peppapighs Date: Fri, 13 Dec 2024 21:41:32 +0700 Subject: [PATCH] Replace mousekeyspr with ZMK mouse emulation feature --- .../build-example-corneish_zen-custom.yml | 5 ++-- .github/workflows/build-example-mouse.yml | 14 +++++++++++ .../workflows/build-example-mousekeyspr.yml | 15 ----------- miryoku/miryoku.dtsi | 13 ++-------- miryoku/miryoku.h | 6 +---- ...ge_mousekeyspr.dtsi => miryoku_mouse.dtsi} | 2 -- ...u_kludge_mousekeyspr.h => miryoku_mouse.h} | 4 +-- miryoku/miryoku_mousekeys.dtsi | 6 ----- miryoku/miryoku_mousekeys.h | 17 ------------- readme.org | 25 +++++-------------- 10 files changed, 27 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/build-example-mouse.yml delete mode 100644 .github/workflows/build-example-mousekeyspr.yml rename miryoku/{miryoku_kludge_mousekeyspr.dtsi => miryoku_mouse.dtsi} (98%) rename miryoku/{miryoku_kludge_mousekeyspr.h => miryoku_mouse.h} (87%) delete mode 100644 miryoku/miryoku_mousekeys.dtsi delete mode 100644 miryoku/miryoku_mousekeys.h diff --git a/.github/workflows/build-example-corneish_zen-custom.yml b/.github/workflows/build-example-corneish_zen-custom.yml index f82285641..e365073df 100644 --- a/.github/workflows/build-example-corneish_zen-custom.yml +++ b/.github/workflows/build-example-corneish_zen-custom.yml @@ -12,6 +12,5 @@ jobs: "corneish_zen_v1_left","corneish_zen_v1_right", "corneish_zen_v2_left","corneish_zen_v2_right" ]' - custom_config: '["#define MIRYOKU_KLUDGE_MOUSEKEYSPR"]' - kconfig: '["CONFIG_ZMK_MOUSE=y\nCONFIG_ZMK_DISPLAY_HIDE_MOMENTARY_LAYERS=y\nCONFIG_CUSTOM_WIDGET_LAYER_STATUS_HIDE_HEADING=y\nCONFIG_CUSTOM_WIDGET_LOGO_IMAGE_MIRYOKU=y\nCONFIG_IL0323_INVERT=y"]' - branches: '["zmkfirmware/zmk/main caksoylar/zmk/caksoylar/zen-v1+v2 petejohanson/zmk/feat/pointers-move-scroll"]' + kconfig: '["CONFIG_ZMK_POINTING=y\nCONFIG_ZMK_DISPLAY_HIDE_MOMENTARY_LAYERS=y\nCONFIG_CUSTOM_WIDGET_LAYER_STATUS_HIDE_HEADING=y\nCONFIG_CUSTOM_WIDGET_LOGO_IMAGE_MIRYOKU=y\nCONFIG_IL0323_INVERT=y"]' + branches: '["zmkfirmware/zmk/main caksoylar/zmk/caksoylar/zen-v1+v2"]' diff --git a/.github/workflows/build-example-mouse.yml b/.github/workflows/build-example-mouse.yml new file mode 100644 index 000000000..65eee8361 --- /dev/null +++ b/.github/workflows/build-example-mouse.yml @@ -0,0 +1,14 @@ +# Copyright 2024 Manna Harbour +# https://github.com/manna-harbour/miryoku + +name: "Build Example Mouse Emulation" +on: workflow_dispatch +jobs: + build: + uses: ./.github/workflows/main.yml + secrets: inherit + with: + board: '["nice_nano"]' + shield: '["corne_left"]' + kconfig: '["CONFIG_ZMK_POINTING=y"]' + branches: '["zmkfirmware/zmk/main"]' diff --git a/.github/workflows/build-example-mousekeyspr.yml b/.github/workflows/build-example-mousekeyspr.yml deleted file mode 100644 index ebb4d9387..000000000 --- a/.github/workflows/build-example-mousekeyspr.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2024 Manna Harbour -# https://github.com/manna-harbour/miryoku - -name: 'Build Example mousekeyspr' -on: workflow_dispatch -jobs: - build: - uses: ./.github/workflows/main.yml - secrets: inherit - with: - board: '["nice_nano"]' - shield: '["corne_left"]' - custom_config: '["#define MIRYOKU_KLUDGE_MOUSEKEYSPR"]' - kconfig: '["CONFIG_ZMK_MOUSE=y"]' - branches: '["petejohanson/zmk/feat/pointers-move-scroll","zmkfirmware/zmk/main petejohanson/zmk/feat/pointers-move-scroll"]' diff --git a/miryoku/miryoku.dtsi b/miryoku/miryoku.dtsi index d113f0a37..7dfd3a720 100644 --- a/miryoku/miryoku.dtsi +++ b/miryoku/miryoku.dtsi @@ -2,11 +2,6 @@ // https://github.com/manna-harbour/miryoku #include -#include -#if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR) - #include - #include -#endif #include #include #include @@ -15,7 +10,7 @@ #include "miryoku.h" -#include +#include / { keymap { @@ -34,11 +29,7 @@ MIRYOKU_LAYER_LIST #include "miryoku_double_tap_guard.dtsi" -#if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR) - #include "miryoku_kludge_mousekeyspr.dtsi" -#else - #include "miryoku_mousekeys.dtsi" -#endif +#include "miryoku_mouse.dtsi" #if defined (MIRYOKU_KLUDGE_THUMBCOMBOS) #include "miryoku_kludge_thumbcombos.dtsi" diff --git a/miryoku/miryoku.h b/miryoku/miryoku.h index 18cc78e8e..04cf097cb 100644 --- a/miryoku/miryoku.h +++ b/miryoku/miryoku.h @@ -31,11 +31,7 @@ #include "miryoku_shift_functions.h" -#if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR) - #include "miryoku_kludge_mousekeyspr.h" -#else - #include "miryoku_mousekeys.h" -#endif +#include "miryoku_mouse.h" #if defined (MIRYOKU_KLUDGE_TAPDELAY) #include "miryoku_kludge_tapdelay.h" diff --git a/miryoku/miryoku_kludge_mousekeyspr.dtsi b/miryoku/miryoku_mouse.dtsi similarity index 98% rename from miryoku/miryoku_kludge_mousekeyspr.dtsi rename to miryoku/miryoku_mouse.dtsi index 1521053db..c0264352b 100644 --- a/miryoku/miryoku_kludge_mousekeyspr.dtsi +++ b/miryoku/miryoku_mouse.dtsi @@ -7,10 +7,8 @@ delay-ms = ; }; -/* &msc { acceleration-exponent = ; time-to-max-speed-ms = ; delay-ms = ; }; -*/ diff --git a/miryoku/miryoku_kludge_mousekeyspr.h b/miryoku/miryoku_mouse.h similarity index 87% rename from miryoku/miryoku_kludge_mousekeyspr.h rename to miryoku/miryoku_mouse.h index 0790e474d..b0814ff69 100644 --- a/miryoku/miryoku_kludge_mousekeyspr.h +++ b/miryoku/miryoku_mouse.h @@ -3,8 +3,8 @@ #pragma once -#define ZMK_MOUSE_DEFAULT_MOVE_VAL 1250 -#define ZMK_MOUSE_DEFAULT_SCRL_VAL 100 +#define ZMK_POINTING_DEFAULT_MOVE_VAL 1250 +#define ZMK_POINTING_DEFAULT_SCRL_VAL 100 #define U_MOUSE_MOVE_EXPONENT 1 #define U_MOUSE_MOVE_TIME 1500 diff --git a/miryoku/miryoku_mousekeys.dtsi b/miryoku/miryoku_mousekeys.dtsi deleted file mode 100644 index d5894e040..000000000 --- a/miryoku/miryoku_mousekeys.dtsi +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2022 Manna Harbour -// https://github.com/manna-harbour/miryoku - -U_MACRO(u_macro_btn1, wait-ms = <0>; bindings = <&kp KP_SLASH &kp KP_N5>;) -U_MACRO(u_macro_btn2, wait-ms = <0>; bindings = <&kp KP_MINUS &kp KP_N5>;) -U_MACRO(u_macro_btn3, wait-ms = <0>; bindings = <&kp KP_ASTERISK &kp KP_N5>;) diff --git a/miryoku/miryoku_mousekeys.h b/miryoku/miryoku_mousekeys.h deleted file mode 100644 index e8a77dd44..000000000 --- a/miryoku/miryoku_mousekeys.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2022 Manna Harbour -// https://github.com/manna-harbour/miryoku - -#pragma once - -#define U_BTN1 &mkp MB1 -#define U_BTN2 &mkp MB2 -#define U_BTN3 &mkp MB3 - -#define U_MS_D &kp KP_N2 -#define U_MS_L &kp KP_N4 -#define U_MS_R &kp KP_N6 -#define U_MS_U &kp KP_N8 -#define U_WH_D U_NU -#define U_WH_L U_NU -#define U_WH_R U_NU -#define U_WH_U U_NU diff --git a/readme.org b/readme.org index 1cbf068af..7375a214c 100644 --- a/readme.org +++ b/readme.org @@ -25,7 +25,7 @@ The [[#keyboard-keymaps][keyboard keymaps]] are composed of the config file, a [ [[#double-tap-boot][double tap boot]], [[#global-shift-functions][global shift functions]], [[#key-emulation-combos][key emulation combos]], -[[#mouse-keys][mouse keys]], +[[#mouse-emulation][mouse emulation]], [[#soft-off][soft off]], [[#tap-delay][tap delay]], and [[#𝑥MK][𝑥MK]]. @@ -566,28 +566,15 @@ Requires ~CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=16~ [[#kconfig-configuration][Kcon On each hand, combo the primary and secondary thumb keys to emulate the tertiary thumb key. Requires suitable keycaps to enable the thumb to press both keys simultaneously. -*** Mouse Keys +*** Mouse Emulation -[[https://zmk.dev/docs/behaviors/mouse-emulation][ZMK supports mouse buttons only]]. +[[https://zmk.dev/docs/keymaps/behaviors/mouse-emulation][Mouse emulation]] can be enabled to support mouse movement and scrolling. -**** Mouse Keys on Host +To build, add ~CONFIG_ZMK_POINTING=y~ to the [[#kconfig-configuration][Kconfig configuration]]. -Mouse movement requires [[https://en.wikipedia.org/wiki/Mouse_keys][enabling mouse keys on the host]]. Mouse scroll is not supported. +For [[#workflow-builds][workflow builds]] using the [[#build-inputs][Build Inputs]] workflow, use ~CONFIG_ZMK_POINTING=y~ with the ~kconfig~ option. -- [[https://linuxreviews.org/HOWTO_use_the_numeric_keyboard_keys_as_mouse_in_XOrg][X11]] -- [[https://support.apple.com/en-au/guide/mac-help/mh27469/mac][Mac]] -- [[https://support.microsoft.com/en-us/windows/use-mouse-keys-to-move-the-mouse-pointer-9e0c72c8-b882-7918-8e7b-391fd62adf33][Windows]] - - -**** Mousekeys PR - -Mouse movement and scroll is supported with https://github.com/petejohanson/zmk/tree/feat/pointers-move-scroll from https://github.com/zmkfirmware/zmk/pull/2027. - -To build, add ~#define MIRYOKU_KLUDGE_MOUSEKEYSPR~ to the [[#config-file][config file]], add ~CONFIG_ZMK_MOUSE=y~ to the [[#kconfig-configuration][Kconfig configuration]], and switch to or merge the mousekeys branch. - -For [[#workflow-builds][workflow builds]] using the [[#build-inputs][Build Inputs]] workflow, use ~#define MIRYOKU_KLUDGE_MOUSEKEYSPR~ with the ~custom_config~ option, ~CONFIG_ZMK_MOUSE=y~ with the ~kconfig~ option, and ~petejohanson/zmk/feat/pointers-move-scroll~ with the ~branches~ option. Alternatively, use ~zmkfirmware/zmk/main petejohanson/zmk/feat/pointers-move-scroll~ to attempt an automatic [[#branches][merge]] of the branch into ZMK main. - -For workflow builds using [[#build-examples][Build Example]] workflows, see the [[.github/workflows/build-example-mousekeyspr.yml][Build Example mousekeyspr]] workflow. +For workflow builds using [[#build-examples][Build Example]] workflows, see the [[.github/workflows/build-example-mouse.yml][Build Example Mouse Emulation]] workflow. For local builds, make the changes locally.