Crates.io | terminator-workflow-recorder |
lib.rs | terminator-workflow-recorder |
version | 0.15.9 |
created_at | 2025-06-25 18:13:25.011321+00 |
updated_at | 2025-09-25 23:53:49.980419+00 |
description | A crate for recording user workflows on Windows |
homepage | https://github.com/mediar-ai/terminator |
repository | https://github.com/mediar-ai/terminator |
max_upload_size | |
id | 1726262 |
size | 583,728 |
A comprehensive workflow recording library for Windows that captures user interactions with UI elements, including mouse clicks, keyboard input, clipboard operations, and UI automation events.
use terminator_workflow_recorder::{WorkflowRecorder, WorkflowRecorderConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = WorkflowRecorderConfig::default();
let mut recorder = WorkflowRecorder::new("My Workflow".to_string(), config);
recorder.start().await?;
// ... perform your workflow ...
recorder.stop().await?;
recorder.save("workflow.json")?;
Ok(())
}
The recorder includes built-in filtering to ignore noisy system UI elements like the clock, notifications, and other system components. You can customize this filtering:
let config = WorkflowRecorderConfig {
// Enable UI event recording
record_ui_focus_changes: true,
record_ui_property_changes: true,
// Filter out noisy system elements
ignore_focus_patterns: vec![
"clock".to_string(),
"notification".to_string(),
"tooltip".to_string(),
"popup".to_string(),
],
ignore_property_patterns: vec![
"clock".to_string(),
"time".to_string(),
"pm".to_string(),
"am".to_string(),
],
ignore_window_titles: vec![
"Windows Security".to_string(),
"Action Center".to_string(),
"Task Manager".to_string(),
],
ignore_applications: vec![
"explorer.exe".to_string(),
"dwm.exe".to_string(),
"winlogon.exe".to_string(),
],
// Other configuration options
..Default::default()
};
record_mouse
: Enable/disable mouse event recordingrecord_keyboard
: Enable/disable keyboard event recordingrecord_clipboard
: Enable/disable clipboard operation recordingrecord_ui_focus_changes
: Enable/disable UI focus change eventsrecord_ui_property_changes
: Enable/disable UI property change eventsmouse_move_throttle_ms
: Minimum time between mouse move events (default: 50ms)ignore_focus_patterns
: Patterns to ignore in focus change eventsignore_property_patterns
: Patterns to ignore in property change eventsignore_window_titles
: Window titles to ignore for all UI eventsignore_applications
: Application names to ignore for all UI eventsmax_clipboard_content_length
: Maximum clipboard content to record (default: 1KB)max_text_selection_length
: Maximum text selection length to record (default: 512 chars)ignore_property_patterns: vec![
"clock".to_string(),
"time".to_string(),
"pm".to_string(),
"am".to_string(),
],
ignore_focus_patterns: vec![
"notification".to_string(),
"action center".to_string(),
"toast".to_string(),
],
ignore_focus_patterns: vec![
"taskbar".to_string(),
"system tray".to_string(),
"start button".to_string(),
],
ignore_applications: vec![
"dwm.exe".to_string(), // Desktop Window Manager
"explorer.exe".to_string(), // Windows Explorer
"winlogon.exe".to_string(), // Windows Logon
"csrss.exe".to_string(), // Client Server Runtime
],
The workflow recorder now supports double click detection with the following features:
let config = WorkflowRecorderConfig {
capture_ui_elements: true, // Enable to capture UI elements on double clicks
// ... other settings
};
Double clicks generate WorkflowEvent::Mouse
events with MouseEventType::DoubleClick
:
match event {
WorkflowEvent::Mouse(mouse_event) => {
match mouse_event.event_type {
MouseEventType::DoubleClick => {
println!("Double click at ({}, {})",
mouse_event.position.x,
mouse_event.position.y);
if let Some(element) = &mouse_event.metadata.ui_element {
println!("Element: {} ({})",
element.name_or_empty(),
element.role());
}
}
_ => {}
}
}
_ => {}
}
See examples/double_click_demo.rs
for a complete example:
cargo run --example double_click_demo
This demo will:
The implementation includes comprehensive unit tests:
cargo test test_double_click_tracker
Tests cover:
The recorder saves workflows as JSON files containing timestamped events:
{
"name": "My Workflow",
"start_time": 1748456891489,
"end_time": 1748456956367,
"events": [
{
"timestamp": 1748456891524,
"event": {
"Keyboard": {
"key_code": 65,
"is_key_down": true,
"character": "a",
"metadata": {
"ui_element": {
"role": "textfield",
"name": "Search Box"
}
}
}
}
}
]
}
record_ui_*
) if not neededmouse_move_throttle_ms
to balance accuracy vs. performanceCurrently supports Windows only. Requires Windows 10/11 with UI Automation support.