Global input hooks
The crates/openlogi-hook crate gives OpenLogi one cross-platform way to observe system mouse and keyboard input. It lets the background agent decide whether an event passes to the normal desktop path or becomes an OpenLogi action. It also provides frontmost-application and pointer-window context for per-app behavior, including a GNOME Shell bridge for native Wayland sessions and a scoped animation rule for the Actions Ring. On Linux, button events also carry the source device identity so the agent can separate evdev input from the same button reported by another input path. See the input and on-screen controls page for the larger product flow.
System role
Hook boundary
The hook is the observation point between physical input and OpenLogi's action system. A caller starts one hook with a callback. The callback receives a common event model and returns either PassThrough or Suppress for each event. This keeps the decision about remapping close to the agent while the hook handles the rules of each operating system.
The hook also offers read-only context queries. It can report the frontmost application for per-app settings, the global cursor position, and the window under the pointer where the platform makes that information available. Windows converts physical cursor samples to the same logical screen coordinate space used by the other supported desktop paths. The visual overlay uses that shared position for cursor-linked UI. The same pointer interface exposes display bounds and cursor repositioning for flows that need stable desktop coordinates; macOS uses its native desktop point space for these values. A separate foreground observer tells consumers when the application value may have changed. On macOS, the same observation keeps a nonblocking Safari process snapshot for input-time actions and seeds it before the hook can receive events. Synthetic events from the companion input injection system must not be treated as new physical input.
macOS also exposes a read-only list of active event taps. This helps the application find another HID-level tap that can compete with OpenLogi and add system-wide pointer latency.
References: crates/…/lib.rs• L41-50 crates/…/lib.rs• L214-280 crates/…/lib.rs• L404-511 crates/…/lib.rs• L515-555 crates/…/lib.rs• L661-703 crates/…/macos.rs• L81-199 crates/…/macos.rs• L248-277 crates/…/probe.rs• L20-80
Pointer-window context
Pointer-window context identifies the native window or desktop surface below the cursor without activating it. The result includes the same application profile identity used by the frontmost lookup when a window can be identified. It also includes a native process and window handle so a caller can check the exact window rather than only the owning application.
The query is a blocking read and must run away from the input callback. It returns Window, Desktop, Unavailable, or Unsupported so a failed lookup cannot be mistaken for the desktop. A second query can verify that the captured window is still the focused window. Native Wayland does not expose this global pointer-window information, so Linux reports it only for X11 sessions and does not silently fall back from an unsupported Wayland session.
Each platform reports a real native window only when it can identify one. On macOS, AppKit first finds the window number under the pointer and Core Graphics then supplies its owner and native identity. This handles click-through overlays that a window-list scan cannot distinguish. A timed-out hit test or invalid window metadata returns Unavailable rather than guessing at an application or the desktop.
References: crates/…/pointer.rs• L12-87 crates/…/pointer.rs• L41-90 crates/…/pointer.rs• L91-123 crates/…/pointer.rs• L139-190 crates/…/pointer.rs• L70-105
Application focus observation
Foreground application changes are exposed as invalidations rather than as a second identity source. The consumer reads the current application after each notification. This keeps the event path small and avoids using an event payload that may already be stale when the consumer handles it.
On macOS, each frontmost-application read and activation update also refreshes a small Safari-only process snapshot. Input handling can read that snapshot without querying AppKit on its time-sensitive path. The hook seeds the snapshot before it starts capture, so an early key or button event uses the current frontmost process rather than an uninitialized value. The activation callback contains panics so an observer failure does not unwind through the Objective-C notification boundary.
On Linux, the process selects one session-appropriate frontmost source. Wayland tries the wlroots foreign-toplevel source and then the GNOME Shell source before it falls back to X11. The selected source is shared by on-demand reads and one observer worker. Its lifecycle has explicit idle, observing, and stopping states, so the source cannot be used by both paths at once. The observer publishes an initial snapshot after subscription, suppresses duplicate values, replays the latest active value to later subscribers, contains callback panics, reports worker health, and returns the source to on-demand use when the final observer closes.
The Windows observer installs one process-wide foreground source and runs its work on a dedicated message-pump thread. It takes an initial authoritative snapshot after registration. Native bursts are coalesced into a fresh read, and the observer reports delivery or worker failure through a health check instead of leaving per-app state silently stale.
References: crates/…/lib.rs• L637-799 crates/…/foreground.rs• L24-115 crates/…/macos.rs• L92-96 crates/…/foreground.rs• L31-59 crates/…/foreground.rs• L137-177 crates/…/foreground.rs• L238-360 crates/…/foreground.rs• L374-555 crates/…/lifecycle.rs• L12-119 crates/…/lifecycle.rs• L122-207 crates/…/foreground.rs• L215-255 crates/…/foreground.rs• L327-361
Platform event sources
Each supported desktop feeds the same event boundary through its native global input facility. The platform choice changes how input is captured and what context can be known, but it does not change the callback contract. On Linux, a supervisor also keeps eligible mice covered when a device node disappears and later returns.
| Platform | Global input source | Main product limit |
|---|---|---|
| macOS | Core Graphics event tap | Accessibility access is required. |
| Linux | evdev device capture with uinput pass-through | The hook targets Logitech relative mice and needs access to input device nodes. |
| Windows | Low-level mouse and keyboard hooks | Mouse events have no physical-device identity. Mouse motion is limited by screen bounds, and only the supported function-key range reaches the remapper. |
The Linux path captures each eligible physical mouse before the desktop sees it. Events that OpenLogi keeps are sent through an OpenLogi virtual mouse, while suppressed events stop at the hook. Button events include the captured mouse's vendor and product identity, which lets the agent distinguish a kernel button event from a matching event delivered through another device path. Touchpads, touchscreens, pointing sticks, foreign vendors, and OpenLogi's own virtual devices stay outside this path so a device that the hook cannot fully reproduce does not lose its normal behavior. A supervisor watches for device-node changes and rescans on a timer, so a mouse that reconnects or returns from suspend can be hooked again.
For high-resolution Linux wheels, pass-through follows the desktop's expected accumulated-scroll behavior. Small movement from rest is held until it crosses the start threshold. A direction change or a pause returns the wheel to rest. Low-resolution wheel counts stay with the matching high-resolution movement, and counts are not forwarded when the callback takes the movement because the action path emits both values.
References: crates/…/lib.rs• L1-7 crates/…/linux.rs• L1-24 crates/…/linux.rs• L151-247 crates/…/linux.rs• L479-612 crates/…/supervisor.rs• L1-17 crates/…/supervisor.rs• L61-98 crates/…/supervisor.rs• L261-332 crates/…/wheel.rs• L1-40 crates/…/wheel.rs• L147-240 crates/…/hook.rs• L91-207 crates/…/hook.rs• L253-320 crates/…/macos.rs• L76-94 crates/…/Cargo.toml• L17-63
Event flow
Event model
The common event model groups input into mouse and keyboard events. Mouse events cover buttons, scroll, pointer movement, and capture interruption. Keyboard events carry a platform-normalized key code, press state, and the four supported modifier keys.
macOS preserves the difference between pixel scroll and wheel-tick scroll when it translates native events. It uses the native event sender when it can identify the device, which helps OpenLogi avoid treating trackpad input as remappable mouse input. For button events that lack HID metadata, it uses the most recent device attribution and keeps the press identity for the matching release. It also filters OpenLogi's synthetic keyboard and mouse events, and maps native key presses with their modifier state into the shared keyboard model. Events marked by OpenLogi as synthetic are filtered before they enter the common model.
Secure Event Input is a macOS session mode that hides KeyDown and KeyUp from every event tap while it is active. Mouse events and modifier-state changes still arrive. The hook exposes the mode and the application attributed by macOS so the user interface can explain why key bindings are temporarily inactive. These reads stay off the input callback because they query session and application state.
Windows ignores events marked as injected so actions produced by input injection do not re-enter the remapper. Its keyboard translator maps Escape and F1 through F19 into the shared function-key vocabulary, including system-key messages used with Alt. Other keys stay on the native path without reaching the callback. Windows derives motion from cursor positions, seeds the motion baseline at button-down, and uses a positive vertical delta for wheel-forward movement so gesture direction matches the other platforms. Before a wheel event reaches the callback, Windows also applies the user's native mouse-wheel direction setting. This keeps a suppressed event and its later replay aligned with the same event passed through by Windows; the setting is refreshed during the run so a change in Windows Settings takes effect without restarting the hook.
Device identity is best effort. macOS can identify the HID sender and use that fact to protect trackpads and limit remaps to Logitech hardware. Linux selects managed devices before the callback and includes vendor and product IDs on button events. Windows leaves the source unknown. A missing identity must therefore be treated as a platform condition rather than proof that the event came from a specific device.
References: crates/…/lib.rs• L66-102 crates/…/lib.rs• L239-309 crates/…/lib.rs• L671-703 crates/…/translate.rs• L31-166 crates/…/translate.rs• L169-291 crates/…/secure_input.rs• L1-64 crates/…/probe.rs• L36-45 crates/…/wheel.rs• L195-224 crates/…/hook.rs• L369-489 crates/…/hook.rs• L509-626 crates/…/scroll_direction.rs• L1-15
Scroll inversion
Scroll inversion changes the sign of vertical mouse-wheel input at the capture boundary. The callback receives the inverted common event, so an intercepted and later replayed action keeps the same direction. A pass-through event is inverted once at the native boundary. The feature preserves the event's native units, leaves horizontal scrolling alone, and applies only to remappable non-trackpad sources. The setting is process-wide for all pointers captured by the hook, not tied to one device profile.
The feature is available on macOS and Linux. macOS changes all native vertical scroll fields in place so both pixel magnitude and wheel-tick magnitude remain intact. Linux changes the physical wheel values before pass-through events are sent through its virtual mouse. Its forwarded low-resolution count receives the same inversion as its high-resolution movement, while a count held for a later movement follows that movement. Windows does not enable this OpenLogi software transform because its low-level hook cannot identify the physical source, so a global transform could reverse touchpad scrolling as well as the configured mouse. Instead, Windows honors the user's own mouse-wheel direction setting when it prepares the event for the callback, which keeps action replay consistent with native pass-through.
The input injection page covers the separate path for emitting synthetic input. The manual invert_scroll example demonstrates the feature in two phases so the change in vertical direction can be compared without relying on the desktop's initial scroll setting.
References: crates/…/lib.rs• L104-237 crates/…/macos.rs• L300-399 crates/…/linux.rs• L385-405 crates/…/linux.rs• L422-500 crates/…/linux.rs• L523-544 crates/…/wheel.rs• L208-224 crates/…/hook.rs• L387-397 crates/…/scroll_direction.rs• L17-143 crates/…/invert_scroll.rs• L1-13
Callback decision
The callback is part of the live input path, so it must make a fast decision and return. PassThrough preserves the original event. Suppress consumes it so the target application does not receive it. The hook owns the background threads and releases its platform resources when stop runs or when the hook is dropped.
The agent keeps slow work away from this path. The hook runtime records events, checks the current binding maps without waiting on a long lock, and places matched actions on a worker queue. If the queue cannot accept an action, the physical event passes through instead of leaving the desktop with a missing button press or a stalled input path. On macOS, a callback panic also passes the event through. Those actions can feed remaps such as camera controls; see camera control for that product behavior.
The flow below shows the relationship between physical input, the hook decision, and the separate action path.
flowchart LR
A[Physical input] --> B[Platform hook]
B --> C[Common HookEvent]
C --> D[Agent callback]
D -->|PassThrough| E[Desktop target]
D -->|Suppress| F[Event consumed]
D -->|Matched action| G[Action worker]
G --> H[Injection or hardware action]
References: crates/…/lib.rs• L168-223 crates/…/lib.rs• L526-589 crates/…/macos.rs• L346-399 crates/…/linux.rs• L479-500 crates/…/hook_runtime.rs• L236-257 crates/…/hook_runtime.rs• L371-474
Binding and gesture handling
The agent uses button events for remaps and uses movement events to detect a hold-and-swipe gesture. A gesture button is held back while the agent waits for enough movement. The movement itself still passes through so the pointer does not stop. A short hold becomes the button's click action, while a committed direction becomes its mapped action.
Keyboard bindings use the same action queue. A matching key-down can suppress the native key, while an unmatched key and key-up pass through. The binding maps are published as one shared view so a config change cannot mix a new button map with an old gesture map during one event.
References: crates/…/hook_runtime.rs• L83-106 crates/…/hook_runtime.rs• L120-189 crates/…/hook_runtime.rs• L260-369 crates/…/hook_runtime.rs• L429-460
Linux desktop context
Frontmost application identity
The hook crate supplies the app identity that the agent uses to choose per-app behavior. Linux selects one backend when the process first needs the value, based on the desktop session, and keeps that backend for the process lifetime.
Wayland-native sessions try the wlroots foreign-toplevel protocol first and the GNOME Shell source next. X11 sessions use X11, and X11 is also the final fallback for other sessions. X11 and XWayland provide the WM_CLASS class value. The wlroots source provides the xdg-shell app_id. The GNOME source provides WM_CLASS through its bridge. These identifiers are opaque profile keys. An application profile made under one identifier space does not automatically match a different space.
The X11 observer watches both the active-window property and the focused window's WM_CLASS. This matters for applications that keep focus while replacing a provisional class with a more specific class. When no usable source exists, the hook returns no frontmost identity instead of failing input capture. On Wayland, the X11 fallback can still identify XWayland windows, but it returns no identity for native Wayland windows.
References: crates/…/foreground.rs• L31-59 crates/…/foreground.rs• L98-177 crates/…/foreground.rs• L414-429 crates/…/lifecycle.rs• L12-119 crates/…/linux.rs• L91-101 crates/…/pointer.rs• L7-12 crates/…/x11.rs• L1-9 crates/…/x11.rs• L131-180 crates/…/x11.rs• L208-253
GNOME Shell bridge
GNOME Shell does not expose the focused window to an ordinary Wayland client. OpenLogi fills this gap with a small GNOME Shell extension that publishes only the focused window's WM_CLASS over the user session D-Bus. The Rust hook backend probes that service and can poll it when the agent asks for the frontmost application.
The extension does not read window titles, window contents, input, or UI state. The Rust backend reads a snapshot when the current identity is requested, and its active observer listens for focus changes and service-owner changes. It subscribes before the first snapshot so a focus transition or extension restart during startup cannot leave the consumer with an old value. Each D-Bus call has a bounded wait, and a lost service clears the current identity before the backend tries to reconnect. When the extension is missing, disabled, or unreachable, the hook can try another Wayland source and then falls through to the X11/XWayland source. That fallback can still identify XWayland windows, but it returns no identity for native Wayland windows.
The same extension excludes the openlogi-action-ring surface from GNOME's window animations. This keeps the ring's first pointer position in a stable coordinate space while the surface appears. Other windows keep the normal animation policy, and disabling the extension removes this scoped exception without changing GNOME's global animation setting.
The diagram shows the GNOME-only path from the focused window to the per-app profile decision.
sequenceDiagram
participant A as Agent
participant H as GNOME hook backend
participant B as Session D-Bus
participant G as GNOME Shell extension
participant W as Focused window
A->>H: Request frontmost app
H->>B: GetFocusedWmClass()
B->>G: D-Bus method call
G->>W: Read focused window WM_CLASS
W-->>G: WM_CLASS or empty value
G-->>B: WM_CLASS string
B-->>H: App identity
G-->>H: Focus or owner change
H-->>A: Invalidate and re-read
To enable this path, install the extension in the user's GNOME extension directory, log out and back in on Wayland, and enable it. The service name, object path, method, and signal form a contract between the extension and the Rust backend. The extension supports GNOME Shell versions 45 through 50 and installs the animation helper with the D-Bus service.
References: crates/…/gnome_shell.rs• L1-19 crates/…/gnome_shell.rs• L31-54 crates/…/gnome_shell.rs• L87-157 crates/…/gnome_shell.rs• L170-249 crates/…/foreground.rs• L137-177 crates/…/README.md• L1-18 crates/…/README.md• L27-42 crates/…/extension.js• L14-50 crates/…/ringAnimation.js• L1-10 crates/…/metadata.json• L1-8
Operating limits
Permissions and platform access
The hook cannot provide useful global observation when the operating system blocks its input source. macOS needs Accessibility trust and a live check that an active filtering tap can still be created. Linux needs read access to the physical input devices and write access to uinput. Windows needs no separate privacy grant, but hook setup can still fail.
The macOS hook checks the cheap trust state before it creates a short-lived filtering probe. The probe matches the live tap's filtering capability, so it also detects a grant that was revoked after startup. While the tap is active, privacy notifications cue a new probe and a five-second heartbeat catches missed notifications. If the probe fails, the tap thread disables and destroys the tap on its own thread so the system input chain is released. A separate lifecycle watchdog remains active until that destruction is confirmed, including during explicit shutdown, and exits the agent if the tap thread cannot make progress.
The agent treats a failed install as a degraded mode. It logs the reason and continues without captured events, so the rest of the application can remain available while input remaps are inactive.
References: crates/…/lib.rs• L405-441 crates/…/lib.rs• L591-619 crates/…/macos.rs• L163-200 crates/…/macos.rs• L489-573 crates/…/grant.rs• L14-81 crates/…/hook_runtime.rs• L371-385 crates/…/hook_runtime.rs• L464-472
Secure Event Input
Secure Event Input is a macOS protection mode used by password fields, Terminal's secure keyboard mode, and some password managers. While any process holds it, macOS sends no key press or key release events to event taps, so mouse remaps continue but keyboard bindings do not receive new key events.
The hook exposes whether the mode is active and which frontmost application macOS attributes it to. The attribution belongs to the window server and can name the frontmost app rather than the background process that enabled the mode. Consumers should use these values for status and explanation, not as a way to bypass the protection.
References: crates/…/lib.rs• L671-703 crates/…/macos.rs• L10-13 crates/…/macos.rs• L41-42 crates/…/secure_input.rs• L1-64
Capture safety
Global input capture has a wider effect than a normal application event handler. A slow callback can delay system input, so the macOS path watches callback progress and tap lifetime. It treats a callback that stays active for 200 milliseconds as stuck. A normal tap stall or teardown has a 1.5-second watched budget, while a capability probe has a separate ten-second budget because WindowServer can take seconds to answer around sleep and wake.
The watchdogs charge time that they were awake to observe. They discount only part of a gap when the kernel reports a sleep or wake inside it, because the process and the tap thread were also frozen during that gap. Gaps without a power transition count in full, and repeated sleep cycles still consume the budget. A tap that the OS repeatedly disables can recover from short bursts, but it stops re-arming after ten attempts in ten seconds instead of holding an unusable HID tap open. The tap remains owned by its run-loop thread. It disables and destroys itself there, while a wedged lifecycle or callback watchdog exits the agent so macOS releases the system-wide tap. Before that exit, the lifecycle watchdog takes a fresh observation; progress made after the initial decision withdraws the exit. The probe and teardown phases use separate budgets, so a slow permission check does not consume the time needed for its later cleanup.
Capture interruptions also cancel an unfinished gesture so a later pointer move cannot trigger an old action. The Linux path restores the physical device when its hook thread stops, and a supervisor rescans for a replacement node after a disconnect or resume. On Windows, motion is derived from the screen cursor position, so a swipe that reaches a screen edge may not produce enough motion for gesture detection. Windows seeds motion tracking from the button-down position, ignores injected mouse and keyboard input, and keeps wheel direction aligned with the other platforms and with the user's Windows mouse setting.
References: crates/…/watchdog.rs• L7-50 crates/…/watchdog.rs• L52-131 crates/…/watchdog.rs• L176-219 crates/…/watchdog.rs• L385-535 crates/…/watchdog.rs• L537-642 crates/…/macos.rs• L401-447 crates/…/macos.rs• L488-576 crates/…/macos.rs• L579-752 crates/…/linux.rs• L479-612 crates/…/supervisor.rs• L1-17 crates/…/supervisor.rs• L261-332 crates/…/hook.rs• L419-507 crates/…/hook.rs• L561-626
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the
HookEventandEventDispositioncontract aligned with every platform translator and withhook_runtime. - Keep the key-code vocabulary aligned between platform keyboard translation and the config key-trigger parser. On Windows, preserve the supported Esc/F1–F19 boundary and the handling of system-key messages.
- If the GNOME D-Bus name, object path, interface, method, signal, or returned identifier changes, update both the Rust proxy and the extension.
- If the GNOME animation exception or the Actions Ring window identity changes, keep the extension helper, metadata, installation instructions, and ring placement behavior aligned. Preserve normal animation for all other windows.
- If Linux frontmost backend order or session detection changes, review native Wayland, XWayland, X11, and GNOME profile matching.
- If Linux device selection or virtual-device capabilities change, check that every captured event can still reach the desktop unchanged when it is passed through.
- If Linux device supervision changes, preserve recovery after node recreation, the distinction between a failed worker and a replaced node, and a bounded rescan when inotify is unavailable.
- If the Linux foreground observer lifecycle changes, preserve single-source ownership across idle reads, observation, and stopping. Keep subscribe-before-publish behavior, latest-value replay, duplicate suppression, callback isolation, health reporting, and source return after the final observer closes.
- If event attribution rules change, preserve the fail-open protection for trackpads, unknown devices, and failed action queue sends.
- If Linux button identity changes, keep the vendor/product source attached to evdev button events and aligned with the agent's direct-route filtering for diverted buttons.
- If macOS button attribution changes, preserve the recent-device fallback for events without HID metadata and keep each release tied to the device resolved for its press.
- If frontmost identifier formats change, review per-app profile matching across X11, XWayland, wlroots, and GNOME Wayland.
- Keep foreground-change callbacks as invalidations that trigger a fresh identity read. Do not make consumers depend on native event payloads.
- If the macOS frontmost-app snapshot changes, preserve the Safari process reset when another app becomes frontmost and seed the snapshot before capture starts.
- If the macOS Accessibility check changes, preserve the cheap trust check followed by an active filtering-tap probe. Keep the notification cue and heartbeat separate from the probe that decides whether capture is safe.
- If the macOS tap lifecycle changes, preserve same-thread tap ownership, own-thread disable and destruction, the independent lifecycle watchdog, the separate probe budget, sleep-aware watched-time accounting, the fresh progress check before a final exit, and the fail-safe process exit for a stuck HID tap.
- If the macOS event translation changes, preserve synthetic-event filtering, device-aware trackpad handling, the distinction between pixel scroll and wheel-tick scroll, and the shared keyboard modifier contract.
- If macOS Secure Event Input reporting changes, preserve the distinction between session-wide key suppression and continued mouse delivery. Keep the status reads off the tap callback.
- If software scroll inversion changes, keep the common callback event and native pass-through event aligned so an intercepted wheel is not replayed in the old direction. Keep it limited to vertical wheel input from remappable non-trackpad sources. Preserve native scroll units, horizontal scrolling, and the process-wide setting contract across macOS and Linux.
- If Windows native scroll-direction handling changes, keep the callback delta aligned with Windows pass-through behavior. Preserve the missing-setting fallback, bounded refresh, vertical-only transform, and replay contract for suppressed wheel events.
- If high-resolution Linux wheel handling changes, keep its rest threshold, direction and timeout rules, low-resolution count pairing, and callback-taken behavior aligned with pass-through and injected scroll.
- If the GNOME D-Bus observer changes, preserve the subscribe-before-snapshot order and the owner-change recovery path.
- If the X11 frontmost observer changes, preserve updates for both active-window changes and
WM_CLASSrewrites on the focused window. Keep unrelated property changes from invalidating per-app state. - If the Windows foreground observer changes, preserve its single callback owner, event coalescing, initial snapshot, and health-reporting contract.
- If pointer-window queries change, preserve the distinction between an unsupported session, an unavailable lookup, the desktop, and a real window. Keep pointer queries off the input callback, keep the macOS main-thread lookup bounded, and keep exact focused-window checks tied to the same native window identity.
- If display bounds or cursor-warp behavior changes, keep platform coordinate spaces aligned with overlay placement and cursor-linked actions. On macOS, preserve the native desktop point contract and cursor association after a warp.
- If Windows motion or scroll translation changes, keep the baseline, screen-edge limitation, native setting alignment, and cross-platform scroll direction consistent with gesture handling.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| macOS Accessibility trust is absent or revoked | The hook cannot capture input, or a live tap could remain in the system input chain after its grant is gone. | Check trust before start, probe active filtering capability while live, respond to grant cues and the heartbeat, and tear down on the tap thread. Keep the lifecycle watchdog armed until destruction is confirmed. |
| macOS Secure Event Input is active | Key presses and releases stop reaching the hook while mouse events continue. | Report the session state and attributed app so the UI can explain the inactive keyboard path. Do not try to bypass the OS protection. |
| A callback blocks or stalls | Global input can lag or stop reaching the desktop. | Keep the callback short, queue actions off-thread, fail open when the queue or lock is not ready, pass callback panics through, and use the callback watchdog for a stuck macOS callback. |
| The macOS tap thread stalls during creation, servicing, probing, or shutdown | A system-wide HID tap can remain active while no thread can release it. | Track lifecycle progress independently, use a separate budget for slow capability probes, account for sleep and wake gaps, withdraw an exit decision when fresh progress proves the thread recovered, and exit the agent when the tap remains hazardous. |
| The OS repeatedly disables the macOS tap | Re-arming can keep an active HID tap in the event chain without a reliable service path. | Re-arm short bursts, then release the tap after the bounded ten-attempt window. |
Linux lacks input-device or uinput access | No eligible mouse hook starts, or a device stays un-hooked. | Require the needed device permissions and skip devices that cannot be grabbed. |
| A GNOME extension is absent, disabled, stalled, or restarted | Native GNOME Wayland windows can lose their frontmost profile key, or the observer can stop receiving focus changes. | Bound D-Bus calls, clear state on disconnect, reconnect the service, try another Wayland source when available, and fall back to X11 for XWayland windows. |
| GNOME animates the Actions Ring surface | The ring's first pointer position can be transformed during opening, which can put its drawing and hit targets away from the cursor. | Keep the exact openlogi-action-ring animation exception active and preserve normal animation for other windows. |
| A Linux frontmost worker stops | Focus invalidations stop and per-app state can remain stale. | Check observer health and use the source again after an orderly observer shutdown. |
| A Linux frontmost observer is dropped while another remains | The shared worker may stop too early or a snapshot read may race with source teardown. | Stop and join only after the final subscriber leaves, then return the selected source to idle snapshot use. |
| A Windows foreground callback cannot queue work or its message loop stops | Per-app state stops receiving focus invalidations and can remain stale. | Coalesce callbacks on the observer thread and expose delivery or worker failure through check_health. |
| More than one Windows foreground observer is started | The second observer cannot claim the process-wide callback owner. | Keep one registered observer and release its ownership before unhooking. |
| A captured Linux device is unplugged or its virtual output fails | Pass-through input for that device stops until the grab is released; a disconnected device can also remain un-hooked after its node returns. | Stop the device thread on I/O failure and release the exclusive grab. Let the supervisor detect a new node and retry it, while avoiding endless retries for an unchanged failed node. |
| A diverted Linux button is reported by both an input session and evdev | One physical press can run the same binding twice. | Carry the evdev vendor/product identity on the button event and let the agent suppress the evdev copy for a live diverted route. |
| Capture loses a button-up event | A later pointer move could look like an old swipe. | Cancel holds on capture interruption and recover stale holds. |
| Windows receives injected input from an OpenLogi action | The action could re-enter the remapper and trigger itself again. | Ignore native mouse and keyboard events marked as injected. |
| A Windows swipe reaches a screen edge | Cursor motion stops changing even while the device reports movement, so a gesture may not reach its threshold. | Treat Windows motion as screen-relative and account for the edge limit in gesture behavior. |
| Safari changes while a press-time action is pending | Navigation input can be sent to the wrong browser process or lose its target. | Refresh the Safari PID on each frontmost observation and read the atomic snapshot without querying AppKit in the input path. |
| A macOS button event has no HID metadata | A valid Logitech button can lose its device identity and fail the remap policy. | Use the latest successful attribution for a press and retain the press identity for its release. |
| Pointer-window metadata is missing or an overlay is on top | A pointer-owned action can target the wrong window or treat an unknown surface as the desktop. | Return Unavailable for failed or blocked hit tests and require an exact focused-window match before a focus-sensitive action. |
| Software scroll inversion is treated as a per-device setting, or is enabled on Windows | A second captured pointer can also reverse its wheel, or an unidentified touchpad can scroll in the wrong direction. | Treat the setting as process-wide and use it only on macOS or Linux for remappable non-trackpad sources. |
| Windows replays a suppressed wheel without the user's native direction setting | A wheel action scrolls opposite to the same physical wheel event passed through by Windows. | Read ReverseMouseWheelDirection with a short cache, use standard behavior when the value is missing or unreadable, and invert only the vertical callback delta when Windows reports reversed direction. |
| A high-resolution Linux wheel is forwarded without its matching low-resolution count | Desktops that use discrete wheel ticks can lose or miscount a notch. | Hold low-resolution counts with held high-resolution movement and forward them only when the matching movement passes through. |
| A Linux wheel rocks near rest or changes direction during a scroll | A middle-click rock can become an unwanted scroll, or a direction change can leak stale movement. | Accumulate from rest, reset on direction change or timeout, and preserve held movement for the next valid scroll. |
Key files
| File | Why to read it |
|---|---|
| crates/…/lib.rs | Defines the cross-platform event vocabulary, callback decision, lifecycle, permission checks, context queries, event-tap diagnostics, foreground observer contract, Secure Event Input status, and scroll inversion control. |
| crates/…/pointer.rs | Defines pointer-window outcomes and the blocking, read-only context and exact-focus queries. |
| crates/…/macos.rs | Shows the macOS global capture boundary, device-aware scroll behavior, frontmost-app snapshot, event-tap diagnostics, live grant checks, safety behavior, and native scroll transformation. |
| crates/…/foreground.rs | Shows macOS activation observation and the Safari process context used by input-time actions. |
| crates/…/grant.rs | Defines when the live macOS Accessibility capability is probed and how missed privacy notifications are covered. |
| crates/…/secure_input.rs | Defines the macOS session checks that explain why keyboard events may stop while mouse events continue. |
| crates/…/pointer.rs | Shows macOS pointer-window lookup and exact focused-window validation. |
| crates/…/probe.rs | Shows macOS desktop pointer state, active display bounds, modifier state, and cursor repositioning in native desktop coordinates. |
| crates/…/translate.rs | Shows how macOS buttons, scroll units, device identity, keyboard input, modifiers, and synthetic events enter the common model. |
| crates/…/watchdog.rs | Defines the safety state and time limits for stuck callbacks, tap stalls, slow capability probes, shutdown, power transitions, progress validation, and repeated re-arms. |
| crates/…/linux.rs | Shows Linux device scope, Logitech-only capture, source identity on button events, pass-through behavior, scroll transformation, and frontmost-backend integration. |
| crates/…/wheel.rs | Defines high-resolution wheel accumulation, direction and timeout handling, low-resolution count pairing, and pass-through behavior. |
| crates/…/supervisor.rs | Shows how Linux rescans input nodes and restores hooks after reconnect, power-cycle, or resume events. |
| crates/…/pointer.rs | Shows Linux X11 pointer-window lookup and the session boundary that excludes native Wayland. |
| crates/…/foreground.rs | Shows Linux session-based source selection, shared snapshot and observer ownership, focus publication, and observer health. |
| crates/…/lifecycle.rs | Defines the source and publication lifecycles that prevent concurrent snapshot and observer ownership. |
| crates/…/tests.rs | Verifies source hand-off, failed starts, orderly stops, fresh publication sessions, duplicate suppression, and observer replay rules. |
| crates/…/x11.rs | Shows the X11 and XWayland frontmost identity source, focused-class updates, and focus-change notifications. |
| crates/…/hook.rs | Shows Windows mouse and keyboard observation, injected-input filtering, cursor context, normalized motion and wheel translation, native scroll-direction alignment, and the Windows foreground-app query. |
| crates/…/scroll_direction.rs | Defines how Windows reads and caches the user's native mouse-wheel direction and applies it to replayable wheel events. |
| crates/…/pointer.rs | Shows Windows pointer-window lookup and exact foreground-window validation. |
| crates/…/cursor.rs | Shows how Windows cursor samples are normalized into the shared logical coordinate space. |
| crates/…/foreground.rs | Shows Windows foreground-change invalidation, initial snapshot, coalescing, health checks, and shutdown. |
| crates/…/worker.rs | Shows the shared Windows worker lifecycle and foreground notification state. |
| crates/…/gnome_shell.rs | Defines the Rust side of the GNOME frontmost-window contract and its live focus observer. |
| crates/…/stop.rs | Defines the stop and wake contract that lets foreground observers leave native and async waits during teardown. |
| crates/…/extension.js | Shows the GNOME Shell D-Bus service and the scoped Actions Ring animation override. |
| crates/…/ringAnimation.js | Defines the rule that keeps the Actions Ring out of surface-transforming window animations. |
| crates/…/README.md | Describes GNOME installation, enablement, service checks, and live ring placement checks. |
| crates/…/metadata.json | Defines the extension identity and supported GNOME Shell versions. |
| crates/…/pointer_context.rs | Provides a small smoke test for observing the native target under the pointer without activating it. |
| crates/…/invert_scroll.rs | Provides a manual two-phase check that vertical wheel direction changes while horizontal scrolling stays unchanged. |
| crates/…/hook_runtime.rs | Connects observed events to bindings, gestures, queued actions, and fail-open behavior. |