# hylmithecoder/handgesturemouse architecture

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

- Interactive diagram: https://gitdiagram.com/hylmithecoder/handgesturemouse
- Repository: https://github.com/hylmithecoder/handgesturemouse

## Overview

Hand Gesture Mouse is a real-time webcam application that turns hand poses into pointer, click, scroll, and desktop-navigation actions. The principal flow is camera frames through landmark tracking and gesture detection, then gesture control through a platform backend. Configuration tunes this flow; smoothing stabilizes pointer movement, and a separate tray widget reports gesture status. The excerpts show the main loop and controller, but not tracker internals or the Windows backend implementation, so those relationships are limited to documented or visible wiring.

Main entry points: [`main.py`](https://github.com/hylmithecoder/handgesturemouse/blob/master/main.py) (Runtime loop), [`handgesture/backends/__init__.py`](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/__init__.py) (Backend selector), [`handgesture/controller.py`](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/controller.py) (Gesture controller), [`handgesture/backends/hyprland.py`](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/hyprland.py) (Hyprland backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_main["Runtime loop<br/>[main.py]"]
  node_config["Configuration<br/>[config.py]"]
end

subgraph group_vision["Gesture processing"]
  node_tracker["Hand tracker<br/>[tracker.py]"]
  node_detector["Gesture detector<br/>[gestures.py]"]
  node_smoother["Pointer smoother<br/>[smoothing.py]"]
end

subgraph group_actions["Desktop actions"]
  node_controller["Gesture controller<br/>[controller.py]"]
  node_factory["Backend selector<br/>[__init__.py]"]
  node_backend["Backend interface<br/>[base.py]"]
  node_dryrun["Dry-run backend<br/>[base.py]"]
  node_hypr["Hyprland backend<br/>[hyprland.py]"]
  node_pynput["Pynput backend<br/>[pynput_base.py]"]
  node_windows["Windows backend<br/>[windows.py]"]
  node_macos["macOS backend<br/>[macos.py]"]
end

subgraph group_status["Status interface"]
  node_tray["Tray widget<br/>[tray.py]"]
end

node_user(("User"))
node_camera(("Webcam"))
node_desktop(("Desktop environment"))
node_ydotool["ydotool service"]
node_trayhost(("System tray host"))

node_user -->|"makes gestures"| node_camera
node_camera -->|"provides frames"| node_main
node_main -->|"processes frames"| node_tracker
node_tracker -->|"returns landmarks"| node_main
node_main -->|"classifies landmarks"| node_detector
node_detector -->|"returns gesture"| node_main
node_main -->|"updates actions"| node_controller
node_main -->|"selects backend"| node_factory
node_main -->|"configures runtime"| node_config
node_controller -->|"smooths pointer"| node_smoother
node_controller -->|"dispatches actions"| node_backend
node_factory -->|"selects dry run"| node_dryrun
node_factory -->|"selects on Hyprland"| node_hypr
node_factory -->|"selects on Windows"| node_windows
node_factory -->|"selects on macOS"| node_macos
node_hypr -->|"sends desktop actions"| node_desktop
node_hypr -->|"sends pointer events"| node_ydotool
node_windows -->|"uses shared controls"| node_pynput
node_macos -->|"uses shared controls"| node_pynput
node_pynput -.->|"injects input"| node_desktop
node_main -->|"updates gesture status"| node_tray
node_tray -->|"registers status icon"| node_trayhost

click node_main "https://github.com/hylmithecoder/handgesturemouse/blob/master/main.py"
click node_config "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/config.py"
click node_tracker "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/tracker.py"
click node_detector "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/gestures.py"
click node_controller "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/controller.py"
click node_smoother "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/smoothing.py"
click node_factory "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/__init__.py"
click node_backend "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/base.py"
click node_dryrun "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/base.py"
click node_hypr "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/hyprland.py"
click node_pynput "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/pynput_base.py"
click node_windows "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/windows.py"
click node_macos "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/macos.py"
click node_tray "https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/tray.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_main,node_config,node_user toneBlue
class node_tracker,node_detector,node_smoother toneAmber
class node_controller,node_factory,node_backend,node_dryrun,node_hypr,node_pynput,node_windows,node_macos toneMint
class node_tray toneRose
class node_camera,node_desktop,node_ydotool,node_trayhost toneIndigo
```

## Components

### Application runtime

- [Runtime loop](https://github.com/hylmithecoder/handgesturemouse/blob/master/main.py): `main.py`
- [Configuration](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/config.py): `handgesture/config.py`

### Gesture processing

- [Hand tracker](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/tracker.py): `handgesture/tracker.py`
- [Gesture detector](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/gestures.py): `handgesture/gestures.py`
- [Pointer smoother](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/smoothing.py): `handgesture/smoothing.py`

### Desktop actions

- [Gesture controller](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/controller.py): `handgesture/controller.py`
- [Backend selector](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/__init__.py): `handgesture/backends/__init__.py`
- [Backend interface](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/base.py): `handgesture/backends/base.py`
- [Dry-run backend](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/base.py): `handgesture/backends/base.py`
- [Hyprland backend](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/hyprland.py): `handgesture/backends/hyprland.py`
- [Pynput backend](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/pynput_base.py): `handgesture/backends/pynput_base.py`
- [Windows backend](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/windows.py): `handgesture/backends/windows.py`
- [macOS backend](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/backends/macos.py): `handgesture/backends/macos.py`

### Status interface

- [Tray widget](https://github.com/hylmithecoder/handgesturemouse/blob/master/handgesture/tray.py): `handgesture/tray.py`

### Other components

- **User**
- **Webcam**
- **Desktop environment**
- **ydotool service**
- **System tray host**

## Connections

- User → Webcam: makes gestures (evidence: `README.md`)
- Webcam → Runtime loop: provides frames (evidence: `main.py`)
- Runtime loop → Hand tracker: processes frames (evidence: `main.py`)
- Hand tracker → Runtime loop: returns landmarks (evidence: `main.py`)
- Runtime loop → Gesture detector: classifies landmarks (evidence: `main.py`)
- Gesture detector → Runtime loop: returns gesture (evidence: `main.py`)
- Runtime loop → Gesture controller: updates actions (evidence: `main.py`)
- Runtime loop → Backend selector: selects backend (evidence: `main.py`)
- Runtime loop → Configuration: configures runtime (evidence: `main.py`)
- Gesture controller → Pointer smoother: smooths pointer (evidence: `handgesture/controller.py`)
- Gesture controller → Backend interface: dispatches actions (evidence: `handgesture/controller.py`)
- Backend selector → Dry-run backend: selects dry run (evidence: `handgesture/backends/__init__.py`)
- Backend selector → Hyprland backend: selects on Hyprland (evidence: `handgesture/backends/__init__.py`)
- Backend selector → Windows backend: selects on Windows (evidence: `handgesture/backends/__init__.py`)
- Backend selector → macOS backend: selects on macOS (evidence: `handgesture/backends/__init__.py`)
- Hyprland backend → Desktop environment: sends desktop actions (evidence: `handgesture/backends/hyprland.py`)
- Hyprland backend → ydotool service: sends pointer events (evidence: `handgesture/backends/hyprland.py`)
- Windows backend → Pynput backend: uses shared controls (evidence: `handgesture/backends/windows.py`)
- macOS backend → Pynput backend: uses shared controls (evidence: `handgesture/backends/macos.py`)
- Pynput backend → Desktop environment: injects input
- Runtime loop → Tray widget: updates gesture status (evidence: `main.py`)
- Tray widget → System tray host: registers status icon (evidence: `handgesture/tray.py`)
