Skip to main content

Crate openlogi_hook

Crate openlogi_hook 

Source
Expand description

OS-level mouse-event hook for OpenLogi.

On macOS the hook is implemented with CGEventTap (the same primitive used by Logi Options+ and external-reference). Linux and Windows return HookError::Unsupported from Hook::start — stubs that let the workspace compile on all platforms without feature-gating callers.

§Usage

use openlogi_hook::{Hook, MouseEvent, EventDisposition};

if !Hook::has_accessibility() {
    eprintln!("grant Accessibility access first");
    return;
}

let hook = Hook::start(|event| {
    println!("{event:?}");
    EventDisposition::PassThrough
}).unwrap();

// … later, on shutdown:
hook.stop();

Structs§

Hook
A running OS-level mouse hook. Call Hook::stop to tear down.

Enums§

ButtonId
One of the user-rebindable hotspots on a Logi mouse. The order matches the physical layout from front to side; ButtonId::ALL is consumed by the default-binding generator and the popover trigger list.
EventDisposition
What the hook callback wants the OS to do with the captured event.
HookError
Errors that Hook::start and related functions can produce.
MouseEvent
An event captured at the OS layer.

Functions§

frontmost_bundle_id
Return the macOS bundle identifier of the currently frontmost application, e.g. "com.microsoft.VSCode". None when no app is frontmost, when reading the value fails, or on any non-macOS platform (P1.4).