1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! # monio
//!
//! A pure Rust cross-platform input monitoring library with proper drag detection.
//!
//! ## Features
//!
//! - Cross-platform support (macOS, Windows, Linux)
//! - Proper drag detection (distinguishes `MouseDragged` from `MouseMoved`)
//! - Event grabbing (consume events to prevent them from reaching other apps)
//! - Clean, Rust-idiomatic API with traits and enums
//! - Thread-safe design with atomic state tracking
//! - Event simulation support
//!
//! ## Quick Start
//!
//! ### Listening for Events
//!
//! ```no_run
//! use monio::{listen, Event, EventType};
//!
//! listen(|event: &Event| {
//! match event.event_type {
//! EventType::MouseDragged => {
//! if let Some(mouse) = &event.mouse {
//! println!("Dragging at ({}, {})", mouse.x, mouse.y);
//! }
//! }
//! EventType::KeyPressed => {
//! if let Some(kb) = &event.keyboard {
//! println!("Key pressed: {:?}", kb.key);
//! }
//! }
//! _ => {}
//! }
//! }).expect("Failed to start hook");
//! ```
//!
//! ### Grabbing Events (Blocking Keys/Mouse)
//!
//! ```no_run
//! use monio::{grab, Event, EventType, Key};
//!
//! grab(|event: &Event| {
//! // Block the Escape key
//! if event.event_type == EventType::KeyPressed {
//! if let Some(kb) = &event.keyboard {
//! if kb.key == Key::Escape {
//! println!("Blocked Escape key!");
//! return None; // Consume the event
//! }
//! }
//! }
//! Some(event.clone()) // Pass through
//! }).expect("Failed to start grab");
//! ```
//!
//! ## Architecture
//!
//! The library uses global atomic state tracking (see [`state`] module) to
//! maintain button/modifier state across events. This enables proper detection
//! of drag events - when a mouse move occurs while a button is held, we emit
//! `MouseDragged` instead of `MouseMoved`.
// Re-exports
pub use ;
pub use ;
pub use ;
pub use ;
pub use Key;
pub use ;
pub use ;
// Simulation functions
pub use ;