How krystianhub/stayawake works
Main Components
a) Core System Components:
• Configuration Manager (handling .env and environment variables)
• Mouse Activity Monitor
• Offset Generator (for calculating mouse movements)
• Platform-Specific Power Management
• Windows Implementation
• MacOS Implementation
• Default Implementation
b) Input/Output Systems:
• Mouse Input Detection
• Mouse Movement Simulation
• Configuration File Reader
• Logging System
Architecture Pattern
The project follows a modular architecture with platform-specific implementations. Here's how to represent this:
Top Layer: Main Application Logic
Middle Layer: Platform-Agnostic Components
Bottom Layer: Platform-Specific Implementations
Configuration Flow
• .env file → Configuration Manager → System Settings
Main Process Flow
• Mouse Activity Monitor → Offset Generator → Platform-Specific Implementation
Platform-Specific Flow
• Separate paths for Windows/MacOS implementations
Key Relationships
Config Manager ─────┐
• ↓
Mouse Monitor ──→ Main Logic ──→ Offset Generator
• ↓
• Platform Layer
• ╱ ╲
• Windows MacOS
Important Details
a) Timing Components:
• 15-second activity check interval
• 100-150 pixel movement range
b) Configuration Parameters:
• 6 configurable properties
• Their flow into the system
Technical Specifications
A technical notes section showing:
• Built with Rust
• Platform support (Windows & MacOS)
• Environment variable configuration
• Logging levels