Skip to content

About

Monitors the mouse and keyboard activity

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

Activity Monitor

A comprehensive activity monitoring system that tracks keyboard, mouse, window focus, and camera data to calculate mood scores (Focus and Energy) in real-time.

Features

  • 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

Building

go build -o activity-monitor .

Usage

Basic Usage (Terminal Only)

./activity-monitor

This runs the mood calculation and displays results in the terminal.

With Graph Visualization

./activity-monitor --graph

Opens a window showing Focus (blue) and Energy (orange) scores over the last 20 seconds.

With Mood Server Integration

./activity-monitor --mood-server localhost:50053

Sends calculated mood data to a gRPC server at the specified address.

Combined Options

./activity-monitor --graph --mood-server localhost:50053

Enables both graph visualization and server communication.

Command-Line Flags

  • --graph: Enable real-time graph visualization (default: false)
  • --mood-server: Mood server address for gRPC communication (e.g., localhost:50053)

Architecture

Components

  1. Sources (sources/): Data collectors for keyboard, mouse, window, and camera
  2. Adapters (adapter/): Convert raw metrics into mood scores
  3. Graph Package (pkg/graph/): Reusable time-series visualization
  4. Client (client/): gRPC client for mood service communication

Mood Calculation

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)

gRPC Mood Service

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].

Development

Project Structure

.
├── 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

Additional Tools

X-T Diagram Visualizer

A standalone tool for visualizing two time-series:

go run ./cmd/xtdiagram --demo

Feed custom data via stdin:

go run ./cmd/xtdiagram --demo=false
# Enter two numbers per line: x1 x2

License

See LICENSE file for details.

About

Monitors the mouse and keyboard activity

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages