Skip to content

Commit 2db0741

Browse files
committed
support CONFIG_ZMK_POINTING
It is no longer needed to use downstream branches for mouse support, as proper support was added to zmk upstream already. Update README to reference new Kconfig option, adjust implementation and GitHub workflow files. Signed-off-by: Marcin Niestroj <[email protected]>
1 parent 819b69a commit 2db0741

10 files changed

+56
-96
lines changed

.github/workflows/build-example-corneish_zen-custom.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ jobs:
1212
"corneish_zen_v1_left","corneish_zen_v1_right",
1313
"corneish_zen_v2_left","corneish_zen_v2_right"
1414
]'
15-
custom_config: '["#define MIRYOKU_KLUDGE_MOUSEKEYSPR"]'
16-
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"]'
17-
branches: '["zmkfirmware/zmk/main caksoylar/zmk/caksoylar/zen-v1+v2 petejohanson/zmk/feat/pointers-move-scroll"]'
15+
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"]'
16+
branches: '["zmkfirmware/zmk/main caksoylar/zmk/caksoylar/zen-v1+v2"]'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2024 Manna Harbour
2+
# https://github.com/manna-harbour/miryoku
3+
4+
name: 'Build Example with mouse support'
5+
on: workflow_dispatch
6+
jobs:
7+
build:
8+
uses: ./.github/workflows/main.yml
9+
secrets: inherit
10+
with:
11+
board: '["nice_nano"]'
12+
shield: '["corne_left"]'
13+
kconfig: '["CONFIG_ZMK_POINTING=y"]'

.github/workflows/build-example-mousekeyspr.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

miryoku/miryoku.dtsi

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
// https://github.com/manna-harbour/miryoku
33

44
#include <behaviors.dtsi>
5-
#include <behaviors/mouse_key_press.dtsi>
6-
#if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR)
7-
#include <behaviors/mouse_move.dtsi>
8-
#include <behaviors/mouse_scroll.dtsi>
9-
#endif
5+
#include <behaviors/mouse_keys.dtsi>
106
#include <dt-bindings/zmk/keys.h>
117
#include <dt-bindings/zmk/bt.h>
128
#include <dt-bindings/zmk/rgb.h>
@@ -15,7 +11,7 @@
1511

1612
#include "miryoku.h"
1713

18-
#include <dt-bindings/zmk/mouse.h>
14+
#include <dt-bindings/zmk/pointing.h>
1915

2016
/ {
2117
keymap {
@@ -34,11 +30,7 @@ MIRYOKU_LAYER_LIST
3430

3531
#include "miryoku_double_tap_guard.dtsi"
3632

37-
#if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR)
38-
#include "miryoku_kludge_mousekeyspr.dtsi"
39-
#else
40-
#include "miryoku_mousekeys.dtsi"
41-
#endif
33+
#include "miryoku_mousekeys.dtsi"
4234

4335
#if defined (MIRYOKU_KLUDGE_THUMBCOMBOS)
4436
#include "miryoku_kludge_thumbcombos.dtsi"

miryoku/miryoku.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@
3131

3232
#include "miryoku_shift_functions.h"
3333

34-
#if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR)
35-
#include "miryoku_kludge_mousekeyspr.h"
36-
#else
37-
#include "miryoku_mousekeys.h"
38-
#endif
34+
#include "miryoku_mousekeys.h"
3935

4036
#if defined (MIRYOKU_KLUDGE_TAPDELAY)
4137
#include "miryoku_kludge_tapdelay.h"

miryoku/miryoku_kludge_mousekeyspr.dtsi

Lines changed: 0 additions & 16 deletions
This file was deleted.

miryoku/miryoku_kludge_mousekeyspr.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

miryoku/miryoku_mousekeys.dtsi

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
// Copyright 2022 Manna Harbour
22
// https://github.com/manna-harbour/miryoku
33

4-
U_MACRO(u_macro_btn1, wait-ms = <0>; bindings = <&kp KP_SLASH &kp KP_N5>;)
5-
U_MACRO(u_macro_btn2, wait-ms = <0>; bindings = <&kp KP_MINUS &kp KP_N5>;)
6-
U_MACRO(u_macro_btn3, wait-ms = <0>; bindings = <&kp KP_ASTERISK &kp KP_N5>;)
4+
&mmv {
5+
acceleration-exponent = <U_MOUSE_MOVE_EXPONENT>;
6+
time-to-max-speed-ms = <U_MOUSE_MOVE_TIME>;
7+
delay-ms = <U_MOUSE_MOVE_DELAY>;
8+
};
9+
10+
/*
11+
&msc {
12+
acceleration-exponent = <U_MOUSE_SCROLL_EXPONENT>;
13+
time-to-max-speed-ms = <U_MOUSE_SCROLL_TIME>;
14+
delay-ms = <U_MOUSE_SCROLL_DELAY>;
15+
};
16+
*/

miryoku/miryoku_mousekeys.h

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@
33

44
#pragma once
55

6+
#define ZMK_POINTING_DEFAULT_MOVE_VAL 1250
7+
#define ZMK_POINTING_DEFAULT_SCRL_VAL 100
8+
9+
#define U_MOUSE_MOVE_EXPONENT 1
10+
#define U_MOUSE_MOVE_TIME 1500
11+
#define U_MOUSE_MOVE_DELAY 0
12+
#define U_MOUSE_SCROLL_EXPONENT 1
13+
#define U_MOUSE_SCROLL_TIME 5000
14+
#define U_MOUSE_SCROLL_DELAY 0
15+
616
#define U_BTN1 &mkp MB1
717
#define U_BTN2 &mkp MB2
818
#define U_BTN3 &mkp MB3
919

10-
#define U_MS_D &kp KP_N2
11-
#define U_MS_L &kp KP_N4
12-
#define U_MS_R &kp KP_N6
13-
#define U_MS_U &kp KP_N8
14-
#define U_WH_D U_NU
15-
#define U_WH_L U_NU
16-
#define U_WH_R U_NU
17-
#define U_WH_U U_NU
20+
#define U_MS_D &mmv MOVE_DOWN
21+
#define U_MS_L &mmv MOVE_LEFT
22+
#define U_MS_R &mmv MOVE_RIGHT
23+
#define U_MS_U &mmv MOVE_UP
24+
#define U_WH_D &msc SCRL_DOWN
25+
#define U_WH_L &msc SCRL_LEFT
26+
#define U_WH_R &msc SCRL_RIGHT
27+
#define U_WH_U &msc SCRL_UP

readme.org

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -568,26 +568,23 @@ On each hand, combo the primary and secondary thumb keys to emulate the tertiary
568568

569569
*** Mouse Keys
570570

571-
[[https://zmk.dev/docs/behaviors/mouse-emulation][ZMK supports mouse buttons only]].
571+
[[https://zmk.dev/docs/behaviors/mouse-emulation][ZMK supports mouse button keys, move and scroll]].
572572

573-
**** Mouse Keys on Host
573+
**** Mouse Keys without ~CONFIG_ZMK_POINTING~
574574

575575
Mouse movement requires [[https://en.wikipedia.org/wiki/Mouse_keys][enabling mouse keys on the host]]. Mouse scroll is not supported.
576576

577577
- [[https://linuxreviews.org/HOWTO_use_the_numeric_keyboard_keys_as_mouse_in_XOrg][X11]]
578578
- [[https://support.apple.com/en-au/guide/mac-help/mh27469/mac][Mac]]
579579
- [[https://support.microsoft.com/en-us/windows/use-mouse-keys-to-move-the-mouse-pointer-9e0c72c8-b882-7918-8e7b-391fd62adf33][Windows]]
580580

581+
**** Mouse support with ~CONFIG_ZMK_POINTING=y~
581582

582-
**** Mousekeys PR
583+
To build, add ~CONFIG_ZMK_POINTING=y~ to the [[#kconfig-configuration][Kconfig configuration]].
583584

584-
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.
585+
For [[#workflow-builds][workflow builds]] using the [[#build-inputs][Build Inputs]] workflow, use ~CONFIG_ZMK_POINTING=y~ with the ~kconfig~ option.
585586

586-
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.
587-
588-
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.
589-
590-
For workflow builds using [[#build-examples][Build Example]] workflows, see the [[.github/workflows/build-example-mousekeyspr.yml][Build Example mousekeyspr]] workflow.
587+
For workflow builds using [[#build-examples][Build Example]] workflows, see the [[.github/workflows/build-example-mouse.yml][Build Example with mouse support]] workflow.
591588

592589
For local builds, make the changes locally.
593590

0 commit comments

Comments
 (0)