A comprehensive activity monitoring system that tracks keyboard, mouse, window focus, and camera data to calculate mood scores (Focus and Energy) in real-time.
- Multi-source Monitoring: Tracks keyboard, mouse, window focus, and camera metrics
- Real-time Mood Calculation: Calculates Focus and Energy scores from multiple inputs
- Live Graph Visualization: Optional real-time graph display using Ebiten
- gRPC Integration: Send mood data to remote servers via gRPC
- Configurable Weights: Customize how each input source affects the final mood score
go build -o activity-monitor ../activity-monitorThis runs the mood calculation and displays results in the terminal.
./activity-monitor --graphOpens a window showing Focus (blue) and Energy (orange) scores over the last 20 seconds.
./activity-monitor --mood-server localhost:50053Sends calculated mood data to a gRPC server at the specified address.
./activity-monitor --graph --mood-server localhost:50053Enables both graph visualization and server communication.
--graph: Enable real-time graph visualization (default: false)--mood-server: Mood server address for gRPC communication (e.g.,localhost:50053)
- Sources (sources/): Data collectors for keyboard, mouse, window, and camera
- Adapters (adapter/): Convert raw metrics into mood scores
- Graph Package (pkg/graph/): Reusable time-series visualization
- Client (client/): gRPC client for mood service communication
The system calculates two mood dimensions:
- Focus Score: Measures concentration and attention (0.0 - 1.0)
- Energy Score: Measures activity and intensity (0.0 - 1.0)
Weights (configurable in main.go):
- Keyboard: 30%
- Mouse: 30%
- Camera: 60%
- Window: 10%
- Previous Mood: 90% (smoothing factor)
The mood client sends data to a MoodService with the following structure:
message MoodMatrix {
int32 focus = 1; // Range: -50 to 50
int32 intensity = 2; // Range: -50 to 50
}
service MoodService {
rpc SetMoodVector(MoodMatrix) returns (google.protobuf.Empty);
}The client automatically scales scores from [0.0, 1.0] to [-50, 50].
.
├── adapter/ # Mood calculation adapters
├── client/ # gRPC mood client
├── cmd/
│ └── xtdiagram/ # Standalone graph visualization tool
├── pkg/
│ └── graph/ # Reusable graph package
├── proto/ # Protocol buffer definitions
│ ├── camera/ # Camera service
│ └── moodmatrix/ # Mood service
└── sources/ # Data source loggers
A standalone tool for visualizing two time-series:
go run ./cmd/xtdiagram --demoFeed custom data via stdin:
go run ./cmd/xtdiagram --demo=false
# Enter two numbers per line: x1 x2See LICENSE file for details.