#1589·OpenLogi

[Bug]: macOS: pointer-targeted dispatch drops Capture Region (and other target-independent actions) when the pointer context is unavailable

Author: joseluislucioCreated Sep 25, 2026Updated Sep 30, 2026

Summary

On macOS with mouse_profile_target = "pointer" (the default), every press of a diverted button is dropped before it reaches the injector when the agent cannot resolve the window under the pointer. That includes actions that don't need a target window at all, such as Capture Region. Setting mouse_profile_target = "focused" fixes it right away.

This looks like the root cause behind #1583 (Back/Forward stopped working in Safari; the workaround reported there is the same "focused application" setting).

Environment

  • OpenLogi 0.8.8 (build 20260925.035928), macOS 27.0 (26A428), Apple Silicon
  • MX Master 3S, Bluetooth direct (pid b034)
  • Binding: Forward = "CaptureRegion", no per-app profiles

What happens

Agent log with OPENLOGI_LOG=debug, three presses of Forward:

DEBUG openlogi_agent_core::watchers::gesture::dispatch: HID++ button → binding key="serial:…" button=Forward action=Capture Region
DEBUG openlogi_agent_core::runtime: mouse action target unavailable or no longer matches — skipped action=Capture Region

The HID++ divert works and the press reaches the right binding, but ActionExecutor::dispatch_to skips it (crates/openlogi-agent-core/src/runtime.rs:94). Nothing is injected and the region selector never appears.

After I changed only mouse_profile_target to "focused" and restarted the agent, the same press produced the HID++ button → binding line with no skipped line, the region selector opened, and the capture landed on the clipboard.

Why (from reading 7275072)

pointer_action_allowed (crates/openlogi-agent-core/src/runtime/pointer.rs:32) returns false whenever the captured target is Unavailable/Unsupported, or differs from the one re-read at dispatch time. That check runs before needs_focus, so it also blocks effects the function itself classifies as not needing focus (Effect::Native(_), Media, Click, Scroll…):

rust
if captured != current
    || matches!(captured, PointerTarget::Unavailable | PointerTarget::Unsupported)
{
    return false;
}
let needs_focus = match action.effect() { … Effect::Native(_) … => false, };

So when the pointer lookup fails on this machine, every pointer-targeted action is dropped, including global ones like Capture Region, Screenshot, media keys or Mission Control.

I haven't found out why the pointer context is unavailable here (the agent has Accessibility and Input Monitoring). That part is unexplained, but I think the gate is a bug on its own either way.

Suggested direction

  • Only enforce the target match/availability for effects that need a window (needs_focus == true). Target-independent effects should run whatever the pointer context says.
  • Log the skip at info/warn instead of debug. At the default level the press disappears without a trace, which is why this is hard to diagnose from user reports.

Side note (possibly separate)

After this morning's auto-update the agent logged releasing the input hook and exiting reason="binary update" and exited with code 0. launchd didn't restart it (KeepAlive = { SuccessfulExit = false }), so no remapping worked until the app was opened again or the service was started by hand with launchctl kickstart.