# shubhendam/lookhop architecture

> Architecture diagram of the GitHub repository shubhendam/lookhop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubhendam/lookhop
- Repository: https://github.com/shubhendam/lookhop

## Overview

LookHop is an offline desktop app that uses webcam-derived head and eye features to determine which display the user is facing, then moves the cursor and optionally focuses that display’s app. The main flow is launch, calibrate, track and classify gaze, apply a display switch, and manage the app through its tray and control panel. The graph also includes configuration and platform support. Some runtime calls are only documented in the README or indicated by the source index; unsampled details are not inferred.

Main entry points: [`lookhop/engine.py`](https://github.com/shubhendam/lookhop/blob/main/lookhop/engine.py) (Gaze state and jumps), [`lookhop/app.py`](https://github.com/shubhendam/lookhop/blob/main/lookhop/app.py) (App entry point), [`lookhop/platform/windows/__init__.py`](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/__init__.py) (Windows backend), [`lookhop/calibrate.py`](https://github.com/shubhendam/lookhop/blob/main/lookhop/calibrate.py) (Calibration workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and tracking"]
  node_app["App entry point<br/>[app.py]"]
  node_config[("Settings and paths<br/>[config.py]")]
  node_tracker["Camera and features<br/>[tracker.py]"]
  node_model["Gaze classifier<br/>[model.py]"]
  node_engine["Gaze state and jumps<br/>[engine.py]"]
end

subgraph group_calibration["Calibration and profiles"]
  node_calibration["Calibration workflow<br/>[calibrate.py]"]
  node_profile["Calibration profile<br/>[model.py]"]
end

subgraph group_interaction["Desktop interaction"]
  node_tray["Tray controller<br/>[tray.py]"]
  node_panel["Control panel<br/>[ui.py]"]
end

subgraph group_platform["Platform support"]
  node_hotkey["Global hotkey<br/>[hotkey.py]"]
  node_autostart["Login startup<br/>[autostart.py]"]
  node_platform_api["Platform interface<br/>[__init__.py]"]
  node_display["Display and cursor<br/>[display.py]"]
  node_focus["Window focus<br/>[focus.py]"]
  node_windows["Windows backend<br/>[__init__.py]"]
  node_macos["macOS stub<br/>[__init__.py]"]
  node_linux["Linux stub<br/>[__init__.py]"]
end

node_user(("User"))
node_os(("Desktop OS"))

node_user -->|"launches"| node_app
node_app -->|"loads"| node_config
node_app -->|"starts if needed"| node_calibration
node_app -->|"starts"| node_engine
node_app -->|"creates"| node_tray
node_calibration -->|"samples features"| node_tracker
node_calibration -->|"trains"| node_model
node_calibration -->|"saves"| node_profile
node_engine -->|"reads frames"| node_tracker
node_engine -->|"classifies gaze"| node_model
node_engine -->|"uses settings"| node_config
node_engine -->|"moves cursor"| node_display
node_engine -->|"focuses window"| node_focus
node_engine -->|"loads calibration"| node_profile
node_tray -->|"controls"| node_engine
node_tray -->|"opens"| node_panel
node_tray -->|"registers"| node_hotkey
node_panel -->|"updates controls"| node_engine
node_panel -->|"edits settings"| node_config
node_panel -->|"sets startup"| node_autostart
node_platform_api -->|"dispatches"| node_windows
node_platform_api -->|"dispatches"| node_macos
node_platform_api -->|"dispatches"| node_linux
node_windows -->|"exports"| node_display
node_windows -->|"exports"| node_focus
node_windows -->|"exports"| node_hotkey
node_windows -->|"exports"| node_autostart
node_display -->|"controls pointer"| node_os
node_focus -->|"activates windows"| node_os
node_hotkey -->|"listens globally"| node_os
node_autostart -->|"configures login"| node_os

click node_app "https://github.com/shubhendam/lookhop/blob/main/lookhop/app.py"
click node_config "https://github.com/shubhendam/lookhop/blob/main/lookhop/config.py"
click node_tracker "https://github.com/shubhendam/lookhop/blob/main/lookhop/tracker.py"
click node_model "https://github.com/shubhendam/lookhop/blob/main/lookhop/model.py"
click node_engine "https://github.com/shubhendam/lookhop/blob/main/lookhop/engine.py"
click node_calibration "https://github.com/shubhendam/lookhop/blob/main/lookhop/calibrate.py"
click node_profile "https://github.com/shubhendam/lookhop/blob/main/lookhop/model.py"
click node_tray "https://github.com/shubhendam/lookhop/blob/main/lookhop/tray.py"
click node_panel "https://github.com/shubhendam/lookhop/blob/main/lookhop/ui.py"
click node_hotkey "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/hotkey.py"
click node_autostart "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/autostart.py"
click node_platform_api "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/__init__.py"
click node_display "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/display.py"
click node_focus "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/focus.py"
click node_windows "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/__init__.py"
click node_macos "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/macos/__init__.py"
click node_linux "https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/linux/__init__.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_config,node_tracker,node_model,node_engine,node_user toneBlue
class node_calibration,node_profile toneAmber
class node_tray,node_panel toneMint
class node_hotkey,node_autostart,node_platform_api,node_display,node_focus,node_windows,node_macos,node_linux toneRose
class node_os toneIndigo
```

## Components

### Runtime and tracking

- [App entry point](https://github.com/shubhendam/lookhop/blob/main/lookhop/app.py): `lookhop/app.py`
- [Settings and paths](https://github.com/shubhendam/lookhop/blob/main/lookhop/config.py): `lookhop/config.py`
- [Camera and features](https://github.com/shubhendam/lookhop/blob/main/lookhop/tracker.py): `lookhop/tracker.py`
- [Gaze classifier](https://github.com/shubhendam/lookhop/blob/main/lookhop/model.py): `lookhop/model.py`
- [Gaze state and jumps](https://github.com/shubhendam/lookhop/blob/main/lookhop/engine.py): `lookhop/engine.py`

### Calibration and profiles

- [Calibration workflow](https://github.com/shubhendam/lookhop/blob/main/lookhop/calibrate.py): `lookhop/calibrate.py`
- [Calibration profile](https://github.com/shubhendam/lookhop/blob/main/lookhop/model.py): `lookhop/model.py`

### Desktop interaction

- [Tray controller](https://github.com/shubhendam/lookhop/blob/main/lookhop/tray.py): `lookhop/tray.py`
- [Control panel](https://github.com/shubhendam/lookhop/blob/main/lookhop/ui.py): `lookhop/ui.py`

### Platform support

- [Global hotkey](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/hotkey.py): `lookhop/platform/windows/hotkey.py`
- [Login startup](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/autostart.py): `lookhop/platform/windows/autostart.py`
- [Platform interface](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/__init__.py): `lookhop/platform/__init__.py`
- [Display and cursor](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/display.py): `lookhop/platform/windows/display.py`
- [Window focus](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/focus.py): `lookhop/platform/windows/focus.py`
- [Windows backend](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/windows/__init__.py): `lookhop/platform/windows/__init__.py`
- [macOS stub](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/macos/__init__.py): `lookhop/platform/macos/__init__.py`
- [Linux stub](https://github.com/shubhendam/lookhop/blob/main/lookhop/platform/linux/__init__.py): `lookhop/platform/linux/__init__.py`

### Other components

- **User**
- **Desktop OS**

## Connections

- User → App entry point: launches (evidence: `README.md`)
- App entry point → Settings and paths: loads (evidence: `lookhop/app.py`)
- App entry point → Calibration workflow: starts if needed (evidence: `lookhop/app.py`)
- App entry point → Gaze state and jumps: starts (evidence: `lookhop/app.py`)
- App entry point → Tray controller: creates (evidence: `lookhop/app.py`)
- Calibration workflow → Camera and features: samples features (evidence: `lookhop/calibrate.py`)
- Calibration workflow → Gaze classifier: trains (evidence: `README.md`)
- Calibration workflow → Calibration profile: saves (evidence: `README.md`)
- Gaze state and jumps → Camera and features: reads frames (evidence: `lookhop/engine.py`)
- Gaze state and jumps → Gaze classifier: classifies gaze (evidence: `lookhop/engine.py`)
- Gaze state and jumps → Settings and paths: uses settings (evidence: `lookhop/engine.py`)
- Gaze state and jumps → Display and cursor: moves cursor (evidence: `lookhop/engine.py`)
- Gaze state and jumps → Window focus: focuses window (evidence: `lookhop/engine.py`)
- Gaze state and jumps → Calibration profile: loads calibration (evidence: `lookhop/engine.py`)
- Tray controller → Gaze state and jumps: controls (evidence: `lookhop/tray.py`)
- Tray controller → Control panel: opens (evidence: `lookhop/tray.py`)
- Tray controller → Global hotkey: registers
- Control panel → Gaze state and jumps: updates controls (evidence: `lookhop/ui.py`)
- Control panel → Settings and paths: edits settings (evidence: `README.md`)
- Control panel → Login startup: sets startup (evidence: `lookhop/ui.py`)
- Platform interface → Windows backend: dispatches (evidence: `lookhop/platform/__init__.py`)
- Platform interface → macOS stub: dispatches (evidence: `lookhop/platform/__init__.py`)
- Platform interface → Linux stub: dispatches (evidence: `lookhop/platform/__init__.py`)
- Windows backend → Display and cursor: exports (evidence: `lookhop/platform/windows/__init__.py`)
- Windows backend → Window focus: exports (evidence: `lookhop/platform/windows/__init__.py`)
- Windows backend → Global hotkey: exports (evidence: `lookhop/platform/windows/__init__.py`)
- Windows backend → Login startup: exports (evidence: `lookhop/platform/windows/__init__.py`)
- Display and cursor → Desktop OS: controls pointer (evidence: `lookhop/platform/windows/display.py`)
- Window focus → Desktop OS: activates windows (evidence: `lookhop/platform/windows/focus.py`)
- Global hotkey → Desktop OS: listens globally (evidence: `README.md`)
- Login startup → Desktop OS: configures login (evidence: `README.md`)
