pub struct MonitorConfig {
pub min_pause_duration: u64,
pub pause_threshold: u64,
pub poll_interval: u64,
pub activity_threshold: u64,
pub min_work_interval: u64,
pub pause_merge_gap: u64,
}Expand description
Activity monitor configuration settings.
Controls the behavior of the background activity monitoring system that tracks user presence, detects work patterns, and manages pause recording.
Fields§
§min_pause_duration: u64Minimum pause duration in minutes to be recorded in the database.
Pauses shorter than this threshold are considered brief interruptions (like answering a quick question) rather than actual breaks and are not stored as separate pause records. This helps keep pause data meaningful and reduces database noise.
pause_threshold: u64Inactivity threshold in seconds before a pause is detected.
When user input (keyboard, mouse) is not detected for this duration, the monitor considers the user to be on a pause. This value should be long enough to avoid false positives during normal work (like reading or thinking) but short enough to capture actual breaks.
poll_interval: u64Poll interval in milliseconds for checking activity status.
This determines how frequently the monitor checks whether the user has been inactive long enough to trigger pause detection. Lower values provide more responsive detection but increase CPU usage. Values between 500-1000ms provide good balance of responsiveness and performance.
activity_threshold: u64Activity duration threshold in seconds for workday start detection.
Continuous activity must exceed this duration before the system considers a workday to have truly started. This prevents brief interactions (like checking time or messages) from incorrectly starting work time tracking, especially during off-hours.
min_work_interval: u64Minimum work interval in minutes for interval merging.
Work intervals shorter than this duration are merged with adjacent intervals to create more meaningful work blocks. This reduces fragmentation in work time reports caused by very brief pauses and helps present cleaner time tracking data.
pause_merge_gap: u64Maximum gap in seconds between two consecutive pauses to merge them.
When the activity monitor briefly registers a stray input between two otherwise continuous inactivity periods, it splits a single break into several adjacent pause records. Pauses separated by a gap no longer than this value are treated as one continuous pause so that sub-threshold segments are not dropped from calculations. The value should stay small (a few tens of seconds) so that genuine short work periods between pauses are preserved rather than swallowed into the break.
Trait Implementations§
Source§impl Clone for MonitorConfig
impl Clone for MonitorConfig
Source§fn clone(&self) -> MonitorConfig
fn clone(&self) -> MonitorConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MonitorConfig
impl Debug for MonitorConfig
Source§impl Default for MonitorConfig
impl Default for MonitorConfig
Source§fn default() -> Self
fn default() -> Self
Provides sensible defaults for monitor configuration.
These default values are carefully chosen based on typical work patterns and provide a good balance between accurate detection and minimal false positives. Users can adjust these values through the configuration system to match their specific work environment and preferences.
§Default Values Rationale
- 20 minutes minimum pause: Captures meaningful breaks while ignoring brief interruptions
- 60 seconds inactivity threshold: Allows for reading/thinking time while detecting real pauses
- 500ms polling interval: Provides responsive detection with reasonable resource usage
- 30 seconds activity threshold: Prevents false workday starts from brief interactions
- 10 minutes minimum work interval: Reduces fragmentation in work reports
Default values:
- 20 minutes minimum pause duration
- 60 seconds inactivity threshold
- 500ms polling interval
- 30 seconds activity threshold
- 10 minutes minimum work interval