Category
Configuration
Target platform
macOS
Problem or use case
I drive Neru alongside a keyboard that sends a real mouse click from a dedicated key (ZSA Voyager, but any pointing device or mouse-button key behaves the same). When I use recursive grid to place the cursor and then click with that key, the click lands correctly but the grid overlay stays up, and I have to press Escape afterwards to dismiss it.
Nothing in Neru can react to that click today. The mode event tap watches keyboard events only, so a physical button press is invisible to the active mode — there is no binding, flag, or setting that can dismiss an overlay when the user clicks with a real mouse.
The --action left_click flag covers the case where Neru performs the click itself, but not the case where the click comes from hardware that Neru does not drive.
Proposed solution
Report the physical mouse buttons to the active mode as bindable named keys — MouseLeft, MouseRight, MouseMiddle — so they can be written in a mode's hotkey table like any other key:
[recursive_grid.hotkeys]
"MouseLeft" = "idle" # clicking anywhere closes the grid
Two properties seem necessary for this to be safe:
- Observe, never consume. The binding runs in addition to the click reaching the application underneath, so the click still does what it normally does.
- Ignore Neru's own clicks. Clicks that Neru performs (
action left_click, --action left_click) must not trigger these bindings, or a binding could recurse into itself.
Being bindable rather than a boolean setting means it composes with macros and works in any mode, and it adds no new config option — which seemed preferable given that every option is a cost.
Since a global hotkey is resolved to a virtual key code and a mouse button has none, a mouse button written in the global [hotkeys] table would parse and then never fire; refusing it there with a message pointing at the mode tables avoids that silent failure.
Alternatives considered
- A boolean like
recursive_grid.exit_on_external_click. Simpler to describe, but it adds a config option, only answers the one question, and cannot express right-click or middle-click, or any action other than exiting.
- Reprogramming the keyboard firmware to tap an unused key (F13) before clicking, and binding that to
idle. Works without any Neru change, but the extra keystroke is then sent everywhere, including outside Neru, so it has to stay unbound in every other application.
- Doing nothing and using
--action left_click. Only helps when Neru performs the click; it cannot see a click from external hardware.
Related but distinct
The existing mouse work all runs the other direction — Neru producing a click. #1102 added right/middle click and the mouse down/up/toggle bindings, and #640 asked for an action that also exits the mode, which shipped as --action exiting on completion. Both are about a click Neru performs. This asks for the input direction: a click Neru did not perform reaching the active mode.
Contribution
Yes — I have this working locally against main and will open a PR shortly. It touches the macOS event tap, the shared key vocabulary, and the config reference; just ci passes.
Category
Configuration
Target platform
macOS
Problem or use case
I drive Neru alongside a keyboard that sends a real mouse click from a dedicated key (ZSA Voyager, but any pointing device or mouse-button key behaves the same). When I use recursive grid to place the cursor and then click with that key, the click lands correctly but the grid overlay stays up, and I have to press Escape afterwards to dismiss it.
Nothing in Neru can react to that click today. The mode event tap watches keyboard events only, so a physical button press is invisible to the active mode — there is no binding, flag, or setting that can dismiss an overlay when the user clicks with a real mouse.
The
--action left_clickflag covers the case where Neru performs the click itself, but not the case where the click comes from hardware that Neru does not drive.Proposed solution
Report the physical mouse buttons to the active mode as bindable named keys —
MouseLeft,MouseRight,MouseMiddle— so they can be written in a mode's hotkey table like any other key:Two properties seem necessary for this to be safe:
action left_click,--action left_click) must not trigger these bindings, or a binding could recurse into itself.Being bindable rather than a boolean setting means it composes with macros and works in any mode, and it adds no new config option — which seemed preferable given that every option is a cost.
Since a global hotkey is resolved to a virtual key code and a mouse button has none, a mouse button written in the global
[hotkeys]table would parse and then never fire; refusing it there with a message pointing at the mode tables avoids that silent failure.Alternatives considered
recursive_grid.exit_on_external_click. Simpler to describe, but it adds a config option, only answers the one question, and cannot express right-click or middle-click, or any action other than exiting.idle. Works without any Neru change, but the extra keystroke is then sent everywhere, including outside Neru, so it has to stay unbound in every other application.--action left_click. Only helps when Neru performs the click; it cannot see a click from external hardware.Related but distinct
The existing mouse work all runs the other direction — Neru producing a click. #1102 added right/middle click and the mouse down/up/toggle bindings, and #640 asked for an action that also exits the mode, which shipped as
--actionexiting on completion. Both are about a click Neru performs. This asks for the input direction: a click Neru did not perform reaching the active mode.Contribution
Yes — I have this working locally against
mainand will open a PR shortly. It touches the macOS event tap, the shared key vocabulary, and the config reference;just cipasses.