# tech-kristal/air-control architecture

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

- Interactive diagram: https://gitdiagram.com/tech-kristal/air-control
- Repository: https://github.com/tech-kristal/air-control

## Overview

AirControl OS is a desktop gesture-control application. The user launches its Qt interface, which starts webcam processing; detected landmarks become gestures that the interface can map to desktop actions, or optionally use for air-mouse control. Gesture mappings persist in JSON, while the hand-tracking model is ensured separately. The excerpts show camera-to-interface signals and action dispatch; some UI-to-storage and air-mouse calls are in omitted sections, so those links are marked unverified.

Main entry points: [`aircontrol/camera_worker.py`](https://github.com/tech-kristal/air-control/blob/main/aircontrol/camera_worker.py) (Camera worker), [`aircontrol/main_window.py`](https://github.com/tech-kristal/air-control/blob/main/aircontrol/main_window.py) (Control interface), [`config.py`](https://github.com/tech-kristal/air-control/blob/main/config.py) (Runtime configuration), [`main.py`](https://github.com/tech-kristal/air-control/blob/main/main.py) (App entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Application startup"]
  node_entry["App entry<br/>[main.py]"]
  node_compat["Python compatibility<br/>[py315_compat.py]"]
  node_ui["Control interface<br/>[main_window.py]"]
end

subgraph group_vision["Vision and recognition"]
  node_camera["Camera worker<br/>[camera_worker.py]"]
  node_recognizer["Gesture recognizer"]
  node_modelmanager["Model manager<br/>[model_manager.py]"]
  node_model["Hand landmark model"]
end

subgraph group_interaction["Desktop interaction"]
  node_engine["Gesture action engine<br/>[action_engine.py]"]
  node_airmouse["Air mouse<br/>[air_mouse.py]"]
end

subgraph group_settings["Mappings and model"]
  node_mapping["Mapping store<br/>[mapping_store.py]"]
  node_mappingfile["Gesture mappings"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_user(("Desktop user"))
node_modelhost["Model download host"]
node_desktop["Desktop input"]

node_user -->|"launches"| node_entry
node_entry -->|"applies workaround"| node_compat
node_entry -->|"creates window"| node_ui
node_ui -->|"starts worker"| node_camera
node_camera -->|"imports before MediaPipe"| node_compat
node_camera -->|"ensures model"| node_modelmanager
node_camera -->|"loads for tracking"| node_model
node_modelmanager -->|"downloads missing model"| node_modelhost
node_camera -->|"classifies landmarks"| node_recognizer
node_camera -->|"emits frames and hands"| node_ui
node_ui -->|"updates mapped actions"| node_engine
node_engine -->|"sends keyboard or scroll input"| node_desktop
node_ui -.->|"uses optional pointer control"| node_airmouse
node_airmouse -->|"moves pointer and clicks"| node_desktop
node_ui -.->|"loads and saves mappings"| node_mapping
node_mapping -->|"reads and writes"| node_mappingfile
node_camera -->|"reads camera settings"| node_config
node_recognizer -->|"reads pinch threshold"| node_config
node_engine -->|"reads timing settings"| node_config
node_airmouse -->|"reads pointer thresholds"| node_config

click node_entry "https://github.com/tech-kristal/air-control/blob/main/main.py"
click node_compat "https://github.com/tech-kristal/air-control/blob/main/aircontrol/py315_compat.py"
click node_ui "https://github.com/tech-kristal/air-control/blob/main/aircontrol/main_window.py"
click node_camera "https://github.com/tech-kristal/air-control/blob/main/aircontrol/camera_worker.py"
click node_recognizer "https://github.com/tech-kristal/air-control/blob/main/aircontrol/gesture_recognizer.py"
click node_modelmanager "https://github.com/tech-kristal/air-control/blob/main/aircontrol/model_manager.py"
click node_model "https://github.com/tech-kristal/air-control/blob/main/models/hand_landmarker.task"
click node_engine "https://github.com/tech-kristal/air-control/blob/main/aircontrol/action_engine.py"
click node_airmouse "https://github.com/tech-kristal/air-control/blob/main/aircontrol/air_mouse.py"
click node_mapping "https://github.com/tech-kristal/air-control/blob/main/aircontrol/mapping_store.py"
click node_mappingfile "https://github.com/tech-kristal/air-control/blob/main/gesture_mappings.json"
click node_config "https://github.com/tech-kristal/air-control/blob/main/config.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_entry,node_compat,node_ui,node_user toneBlue
class node_camera,node_recognizer,node_modelmanager,node_model toneAmber
class node_engine,node_airmouse toneMint
class node_mapping,node_mappingfile,node_config toneRose
class node_modelhost,node_desktop toneIndigo
```

## Components

### Application startup

- [App entry](https://github.com/tech-kristal/air-control/blob/main/main.py): `main.py`
- [Python compatibility](https://github.com/tech-kristal/air-control/blob/main/aircontrol/py315_compat.py): `aircontrol/py315_compat.py`
- [Control interface](https://github.com/tech-kristal/air-control/blob/main/aircontrol/main_window.py): `aircontrol/main_window.py`

### Vision and recognition

- [Camera worker](https://github.com/tech-kristal/air-control/blob/main/aircontrol/camera_worker.py): `aircontrol/camera_worker.py`
- [Gesture recognizer](https://github.com/tech-kristal/air-control/blob/main/aircontrol/gesture_recognizer.py): `aircontrol/gesture_recognizer.py`
- [Model manager](https://github.com/tech-kristal/air-control/blob/main/aircontrol/model_manager.py): `aircontrol/model_manager.py`
- [Hand landmark model](https://github.com/tech-kristal/air-control/blob/main/models/hand_landmarker.task): `models/hand_landmarker.task`

### Desktop interaction

- [Gesture action engine](https://github.com/tech-kristal/air-control/blob/main/aircontrol/action_engine.py): `aircontrol/action_engine.py`
- [Air mouse](https://github.com/tech-kristal/air-control/blob/main/aircontrol/air_mouse.py): `aircontrol/air_mouse.py`

### Mappings and model

- [Mapping store](https://github.com/tech-kristal/air-control/blob/main/aircontrol/mapping_store.py): `aircontrol/mapping_store.py`
- [Gesture mappings](https://github.com/tech-kristal/air-control/blob/main/gesture_mappings.json): `gesture_mappings.json`
- [Runtime configuration](https://github.com/tech-kristal/air-control/blob/main/config.py): `config.py`

### Other components

- **Desktop user**
- **Model download host**
- **Desktop input**

## Connections

- Desktop user → App entry: launches (evidence: `README.md`)
- App entry → Python compatibility: applies workaround (evidence: `main.py`)
- App entry → Control interface: creates window (evidence: `main.py`)
- Control interface → Camera worker: starts worker (evidence: `aircontrol/main_window.py`)
- Camera worker → Python compatibility: imports before MediaPipe (evidence: `aircontrol/camera_worker.py`)
- Camera worker → Model manager: ensures model (evidence: `aircontrol/camera_worker.py`)
- Camera worker → Hand landmark model: loads for tracking
- Model manager → Model download host: downloads missing model (evidence: `aircontrol/model_manager.py`)
- Camera worker → Gesture recognizer: classifies landmarks (evidence: `aircontrol/camera_worker.py`)
- Camera worker → Control interface: emits frames and hands (evidence: `aircontrol/main_window.py`)
- Control interface → Gesture action engine: updates mapped actions (evidence: `aircontrol/main_window.py`)
- Gesture action engine → Desktop input: sends keyboard or scroll input (evidence: `aircontrol/action_engine.py`)
- Control interface → Air mouse: uses optional pointer control (evidence: `aircontrol/main_window.py`)
- Air mouse → Desktop input: moves pointer and clicks (evidence: `aircontrol/air_mouse.py`)
- Control interface → Mapping store: loads and saves mappings (evidence: `aircontrol/main_window.py`)
- Mapping store → Gesture mappings: reads and writes (evidence: `aircontrol/mapping_store.py`)
- Camera worker → Runtime configuration: reads camera settings (evidence: `aircontrol/camera_worker.py`)
- Gesture recognizer → Runtime configuration: reads pinch threshold (evidence: `aircontrol/gesture_recognizer.py`)
- Gesture action engine → Runtime configuration: reads timing settings (evidence: `aircontrol/action_engine.py`)
- Air mouse → Runtime configuration: reads pointer thresholds (evidence: `aircontrol/air_mouse.py`)
