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
//! Global event hooks module
//!
//! This module provides cross-platform global event interception (grab) functionality.
//! It allows intercepting keyboard and mouse events before they reach other applications.
//!
//! # Usage
//!
//! ```no_run
//! use aumate::eventhooks::{grab, Event, EventType, Key};
//!
//! // Callback receives events and can block them by returning None
//! let callback = |event: Event| -> Option<Event> {
//! if let EventType::KeyPress(Key::Escape) = event.event_type {
//! println!("Escape pressed - blocking it");
//! return None; // Block the event
//! }
//! Some(event) // Let other events pass through
//! };
//!
//! // This blocks until exit_grab() is called
//! if let Err(e) = grab(callback) {
//! eprintln!("Failed to grab: {:?}", e);
//! }
//! ```
//!
//! # Platform Notes
//!
//! ## macOS
//! - Requires Accessibility permissions (System Preferences > Security & Privacy > Privacy > Accessibility)
//! - Uses CGEventTap for event interception
//!
//! ## Linux
//! - Uses X11 XGrabKeyboard (keyboard only)
//! - Requires user to be in `input` group for full functionality
//!
//! ## Windows
//! - Uses low-level hooks (SetWindowsHookEx with WH_KEYBOARD_LL and WH_MOUSE_LL)
//! - Works without special permissions
// Re-export types
pub use ;
// Platform-specific re-exports
pub use ;
pub use ;
// Convenience aliases for Linux to match other platforms
pub use exit_grab_listen as exit_grab;
pub use start_grab_listen as grab;
pub use ;