Skip to main content

Module monitor

Module monitor 

Source
Expand description

The activity monitor: input events in, workdays and pauses out.

A background thread listens to raw input via rdev and stamps last_activity; the async loop polls that timestamp and drives a two-state machine (Active / InPause) that writes workday and pause records.

use kasl::libs::config::MonitorConfig;
use kasl::libs::monitor::Monitor;

let config = MonitorConfig {
    pause_threshold: 120,
    activity_threshold: 60,
    poll_interval: 1000,
    min_pause_duration: 30,
    min_work_interval: 15,
    ..Default::default()
};

let mut monitor = Monitor::new(config)?;
monitor.run().await?;

Structs§

Monitor
The monitor’s moving parts: config, database handles, and the shared timestamps the input thread writes.