| Crates.io | mouse-collection-environment |
| lib.rs | mouse-collection-environment |
| version | 0.2.1 |
| created_at | 2025-08-14 04:05:48.338327+00 |
| updated_at | 2026-01-17 20:03:14.361622+00 |
| description | Collection GUI environment for harvesting user mouse data |
| homepage | |
| repository | https://github.com/jrcalgo/generative-mouse-trajectories |
| max_upload_size | |
| id | 1794410 |
| size | 1,391,216 |
A desktop GUI for collecting, processing, and exporting mouse movement data for ML/analytics. It uses Iced for UI and Winit for event capture. Data are batched by left-clicks, derived features are computed, and results are saved to timestamped CSV files.
mouse_data_{YYYYMMDD_HHMMSS}[_n].csvRequirements: Rust toolchain (stable), a desktop environment supported by iced/winit.
cd mouse-collection-environment
cargo run --release
[dependencies]
mouse-collection-environment = { path = "path/to/mouse-collection-environment" }
once_cell = "1"
tokio = { version = "1", features = ["full"] }
use once_cell::sync::Lazy;
use std::sync::Arc;
use tokio::runtime::Runtime;
use mouse_collection_environment::mouse_collector::MouseCollector;
static RT: Lazy<Runtime> = Lazy::new(|| Runtime::new().expect("Failed to create runtime"));
static COLLECTOR: Lazy<Arc<MouseCollector>> =
Lazy::new(|| RT.block_on(MouseCollector::new(false, false)));
fn main() {
// Enter the Tokio runtime so the collector's internals can use it
let _enter = RT.enter();
// Start the recorder thread (no built-in listener window)
let _recorder = MouseCollector::start_recording_thread(&COLLECTOR);
// Optional tunables
COLLECTOR.set_min_derivative_dt(0.006);
COLLECTOR.set_smoothing_alpha(0.25);
COLLECTOR.set_data_dir("data".to_string());
// Push events from your own UI framework
COLLECTOR.push_move((100.0, 200.0));
COLLECTOR.push_left_click((100.0, 200.0));
// Pull stats for your UI
println!("{:?}", COLLECTOR.get_latest_derived_stats());
}
use std::sync::Arc;
use mouse_collection_environment::mouse_collector::MouseCollector;
#[tokio::main]
async fn main() {
let collector: Arc<MouseCollector> = MouseCollector::new(false, false).await;
// Start the winit listener (window) + recorder; set `report` to true to print stats periodically
let (_listen, _record, _report) = collector.clone().start_collecting(false).await;
// Your app can continue doing work here. Drop the process to exit, or add your own shutdown logic.
}
On macOS you may need to allow input monitoring (System Settings → Privacy & Security → Input Monitoring) if you extend this to global capture. This app currently captures inside its own window.
Files are written to the configured data directory (default: data/).
Each run generates a unique file name: mouse_data_{YYYYMMDD_HHMMSS}.csv; if it exists, _n is appended.
Columns:
Notes:
effective_dt = max(raw_dt, min_dt); velocity/acceleration are EMA-smoothed via alpha.|velocity|).mouse_collector.rs implements collection, derivation, batching, and CSV writing; tunables are stored as RwLock<f64> and read at compute time.mouse_gui.rs builds the Iced UI: canvas game area, stats grid, settings, and hotbar controls.