Skip to content

Commit

Permalink
Add warp mode for mouse & scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
urob committed Jan 4, 2025
1 parent d50a69a commit e6d67ac
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
9 changes: 5 additions & 4 deletions config/base.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ ZMK_TAP_DANCE(num_dance, bindings = <&num_word NUM>, <&sl NUM>;
tapping-term-ms = <200>;)

// Smart-mouse, requires tri-state module.
ZMK_TRI_STATE(smart_mouse, bindings = <&tog MOUSE>, <&none>, <&tog MOUSE>;
ignored-key-positions =
<LT1 LT3 RT0 RT1 RT2 RT3 RT4 RM1 RM2 RM3 RB1 RB2 RB3 RH0 RH1>;
ignored-layers = <MOUSE>;)
ZMK_TRI_STATE(
smart_mouse, bindings = <&tog MOUSE>, <&none>, <&tog MOUSE>;
ignored-key-positions =
<LT1 LT3 LH0 LH1 RT1 RT2 RT3 RM0 RM1 RM2 RM3 RM4 RB1 RB2 RB3 RH0 RH1>;
ignored-layers = <MOUSE NAV FN>;)

/* Custom behaviors */

Expand Down
2 changes: 1 addition & 1 deletion config/corneish_zen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=1800000

# Enable mouse
CONFIG_ZMK_POINTING=y
CONFIG_ZMK_POINTING_SMOOTH_SCROLLING=y
# CONFIG_ZMK_POINTING_SMOOTH_SCROLLING=y

# Combo config, automated by build script
CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=6
Expand Down
2 changes: 1 addition & 1 deletion config/glove80.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=1800000

# Enable mouse
CONFIG_ZMK_POINTING=y
CONFIG_ZMK_POINTING_SMOOTH_SCROLLING=y
# CONFIG_ZMK_POINTING_SMOOTH_SCROLLING=y

# Combo config, automated by build script
CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=6
Expand Down
44 changes: 39 additions & 5 deletions config/mouse.dtsi
Original file line number Diff line number Diff line change
@@ -1,22 +1,56 @@
// Settings tuned for 3840 x 2160 display resolution
#define ZMK_POINTING_DEFAULT_MOVE_VAL 1500 // 600
#define ZMK_POINTING_DEFAULT_SCRL_VAL 120 // 10
#define ZMK_POINTING_DEFAULT_MOVE_VAL 600 // 600
#define ZMK_POINTING_DEFAULT_SCRL_VAL 20 // 10

#include <dt-bindings/zmk/pointing.h>
#include <input/processors.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>

// Config from @caksoylar, defaults in comments
// Based on @caksoylar's config, defaults in comments
&mmv {
acceleration-exponent = <1>; // 1
time-to-max-speed-ms = <500>; // 300
delay-ms = <0>; // 0
};

&msc {
acceleration-exponent = <1>; // 0
time-to-max-speed-ms = <800>; // 300
acceleration-exponent = <0>; // 0
time-to-max-speed-ms = <300>; // 300
delay-ms = <0>; // 0
};

&mmv_input_listener {
warp {
layers = <NAV>;
input-processors = <&zip_xy_scaler 3 1>;
};
precision {
layers = <FN>;
input-processors = <&zip_xy_scaler 1 2>;
};
};

/ {
zip_scroll_scaler: zip_scroll_scaler {
compatible = "zmk,input-processor-scaler";
#input-processor-cells = <2>;
type = <INPUT_EV_REL>;
codes = <INPUT_REL_WHEEL INPUT_REL_HWHEEL>;
track-remainders;
};
};

&msc_input_listener {
warp {
layers = <NAV>;
input-processors = <&zip_scroll_scaler 2 1>;
};
precision {
layers = <FN>;
input-processors = <&zip_scroll_scaler 1 2>;
};
};

#define U_MS_U &mmv MOVE_UP
#define U_MS_D &mmv MOVE_DOWN
#define U_MS_L &mmv MOVE_LEFT
Expand Down
2 changes: 1 addition & 1 deletion config/planck_rev6.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CONFIG_ZMK_KEYBOARD_NAME="Planck Rev6"

# Enable mouse
CONFIG_ZMK_POINTING=y
CONFIG_ZMK_POINTING_SMOOTH_SCROLLING=y
# CONFIG_ZMK_POINTING_SMOOTH_SCROLLING=y

# Combo config, automated by build script
CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=6
Expand Down

0 comments on commit e6d67ac

Please sign in to comment.