cel_context/events.rs
1//! CEL event types for the watchdog system.
2
3use serde::{Deserialize, Serialize};
4
5/// Events emitted by the ContextWatchdog when screen state changes.
6/// Includes both polling-based detections and push-based AXObserver notifications.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8#[serde(tag = "type")]
9pub enum CelEvent {
10 /// Accessibility tree changed (elements added or removed).
11 TreeChanged {
12 added: Vec<String>,
13 removed: Vec<String>,
14 },
15 /// Network became idle (no new connections recently).
16 NetworkIdle,
17 /// Keyboard/mouse focus moved to a different element.
18 FocusChanged {
19 old: Option<String>,
20 new: Option<String>,
21 },
22 /// An element's value changed (from AXObserver push notification).
23 ValueChanged {
24 element_id: String,
25 new_value: Option<String>,
26 },
27 /// A new window was created (from AXObserver).
28 WindowCreated { title: Option<String> },
29 /// A menu was opened (from AXObserver).
30 MenuOpened,
31 /// A menu was closed (from AXObserver).
32 MenuClosed,
33 /// A sheet/dialog appeared (from AXObserver).
34 SheetCreated,
35 /// UI layout changed (from AXObserver).
36 LayoutChanged,
37 /// An element's title changed (from AXObserver).
38 TitleChanged { new_title: Option<String> },
39 /// An application was activated (brought to foreground).
40 AppActivated { app_name: Option<String> },
41 /// An application was deactivated (sent to background).
42 AppDeactivated { app_name: Option<String> },
43 /// A window was moved.
44 WindowMoved,
45 /// A window was resized.
46 WindowResized,
47 /// A window was minimized.
48 WindowMinimized,
49 /// A window was restored from minimized state.
50 WindowRestored,
51 /// Selection changed (text, list, etc.).
52 SelectionChanged,
53 /// The number of rows in a table/outline changed.
54 RowCountChanged,
55}