Skip to content

Commit

Permalink
Replace mousekeyspr with ZMK mouse emulation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
peppapighs committed Dec 13, 2024
1 parent 7f32cf0 commit bf75313
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 80 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build-example-corneish_zen-custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]'
14 changes: 14 additions & 0 deletions .github/workflows/build-example-mouse.yml
Original file line number Diff line number Diff line change
@@ -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"]'
15 changes: 0 additions & 15 deletions .github/workflows/build-example-mousekeyspr.yml

This file was deleted.

13 changes: 2 additions & 11 deletions miryoku/miryoku.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
// https://github.com/manna-harbour/miryoku

#include <behaviors.dtsi>
#include <behaviors/mouse_key_press.dtsi>
#if defined (MIRYOKU_KLUDGE_MOUSEKEYSPR)
#include <behaviors/mouse_move.dtsi>
#include <behaviors/mouse_scroll.dtsi>
#endif
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/rgb.h>
Expand All @@ -15,7 +10,7 @@

#include "miryoku.h"

#include <dt-bindings/zmk/mouse.h>
#include <dt-bindings/zmk/pointing.h>

/ {
keymap {
Expand All @@ -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"
Expand Down
6 changes: 1 addition & 5 deletions miryoku/miryoku.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
delay-ms = <U_MOUSE_MOVE_DELAY>;
};

/*
&msc {
acceleration-exponent = <U_MOUSE_SCROLL_EXPONENT>;
time-to-max-speed-ms = <U_MOUSE_SCROLL_TIME>;
delay-ms = <U_MOUSE_SCROLL_DELAY>;
};
*/
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions miryoku/miryoku_mousekeys.dtsi

This file was deleted.

17 changes: 0 additions & 17 deletions miryoku/miryoku_mousekeys.h

This file was deleted.

25 changes: 6 additions & 19 deletions readme.org
Original file line number Diff line number Diff line change
Expand Up @@ -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]].
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit bf75313

Please sign in to comment.