# bassam-alomari/auto-brightness architecture

> Architecture diagram of the GitHub repository bassam-alomari/auto-brightness, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bassam-alomari/auto-brightness
- Repository: https://github.com/bassam-alomari/auto-brightness

## Overview

Auto Brightness estimates ambient light from camera images and adapts selected display brightness, with user-configurable curves, stability safeguards, and Windows desktop controls. The main workflow is start monitoring in the desktop UI, capture and meter camera samples, calculate and verify brightness changes, and report status; settings and review tools shape that behavior. The README also documents a separate experimental Linux terminal and desktop preview. Relationships are limited to README statements and shown source references; unsampled internals are not assumed.

Main entry points: [`src/room_brightness/settings.py`](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/settings.py) (Persistent settings), [`src/room_brightness/qt_ui.py`](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/qt_ui.py) (Qt desktop), [`src/room_brightness/linux_control.py`](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/linux_control.py) (Linux monitor CLI), [`src/room_brightness/adaptive.py`](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/adaptive.py) (Adaptive controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Desktop interfaces"]
  node_qt_ui["Qt desktop<br/>[qt_ui.py]"]
  node_comfort_ui["Curve editor<br/>[comfort_ui.py]"]
  node_tuning_ui["Calibration tools<br/>[tuning_ui.py]"]
  node_review_ui["Display and suggestions<br/>[review_ui.py]"]
end

subgraph group_control["Capture and control"]
  node_qt_engine["Control engine<br/>[qt_engine.py]"]
  node_camera["Camera capture<br/>[camera.py]"]
  node_metering["Image metering<br/>[metering.py]"]
  node_display["Display brightness<br/>[brightness.py]"]
end

subgraph group_adaptation["Adaptation and safeguards"]
  node_adaptive["Adaptive controller<br/>[adaptive.py]"]
  node_comfort["Curve and stability<br/>[comfort.py]"]
  node_quality["Quality safeguards<br/>[quality.py]"]
  node_vision["Image analysis<br/>[vision.py]"]
  node_experience["Power and trials<br/>[experience.py]"]
  node_recovery["Recovery diagnostics<br/>[recovery.py]"]
end

subgraph group_preferences["Settings and tools"]
  node_settings[("Persistent settings<br/>[settings.py]")]
  node_i18n["Languages<br/>[i18n.py]"]
  node_themes["Themes<br/>[themes.py]"]
  node_extras["Profiles and updates<br/>[extras.py]"]
  node_tuning["Calibration and performance<br/>[tuning.py]"]
end

subgraph group_linux["Linux preview"]
  node_linux_control["Linux monitor CLI<br/>[linux_control.py]"]
  node_linux_ui["Linux desktop preview<br/>[linux_ui.py]"]
  node_linux_backup["Linux restore helper<br/>[linux_backup.py]"]
end

node_user(("User"))
node_camera_device(("Camera device"))
node_screen(("Display device"))

node_user -->|"starts monitoring"| node_qt_ui
node_qt_ui -->|"controls"| node_qt_engine
node_qt_engine -->|"loads and saves"| node_settings
node_qt_engine -->|"selects camera"| node_camera
node_camera -->|"captures from"| node_camera_device
node_camera -->|"meters samples"| node_metering
node_metering -->|"checks quality"| node_quality
node_adaptive -->|"gates readings"| node_quality
node_adaptive -->|"uses stability rules"| node_comfort
node_adaptive -->|"uses image targets"| node_vision
node_qt_engine -.->|"controls brightness"| node_display
node_display -->|"reads and writes"| node_screen
node_experience -->|"calculates targets"| node_adaptive
node_experience -->|"builds reports"| node_recovery
node_settings -->|"resolves language"| node_i18n
node_settings -->|"validates theme"| node_themes
node_settings -->|"validates profiles"| node_extras
node_settings -->|"validates options"| node_tuning
node_qt_ui -->|"opens editor"| node_comfort_ui
node_qt_ui -->|"opens tools"| node_tuning_ui
node_qt_ui -->|"opens review"| node_review_ui
node_user -->|"runs preview"| node_linux_control
node_user -->|"opens preview"| node_linux_ui
node_linux_control -->|"uses adaptation"| node_adaptive
node_linux_control -->|"uses metering"| node_metering
node_linux_control -->|"loads preferences"| node_settings
node_linux_ui -->|"uses control"| node_linux_control
node_linux_ui -->|"uses restore helper"| node_linux_backup
node_linux_ui -->|"uses diagnostics"| node_recovery

click node_qt_ui "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/qt_ui.py"
click node_qt_engine "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/qt_engine.py"
click node_camera "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/camera.py"
click node_metering "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/metering.py"
click node_display "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/brightness.py"
click node_adaptive "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/adaptive.py"
click node_comfort "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/comfort.py"
click node_quality "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/quality.py"
click node_vision "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/vision.py"
click node_experience "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/experience.py"
click node_recovery "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/recovery.py"
click node_settings "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/settings.py"
click node_i18n "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/i18n.py"
click node_themes "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/themes.py"
click node_extras "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/extras.py"
click node_tuning "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/tuning.py"
click node_comfort_ui "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/comfort_ui.py"
click node_tuning_ui "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/tuning_ui.py"
click node_review_ui "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/review_ui.py"
click node_linux_control "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/linux_control.py"
click node_linux_ui "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/linux_ui.py"
click node_linux_backup "https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/linux_backup.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_qt_ui,node_comfort_ui,node_tuning_ui,node_review_ui,node_user toneBlue
class node_qt_engine,node_camera,node_metering,node_display toneAmber
class node_adaptive,node_comfort,node_quality,node_vision,node_experience,node_recovery toneMint
class node_settings,node_i18n,node_themes,node_extras,node_tuning toneRose
class node_linux_control,node_linux_ui,node_linux_backup,node_camera_device,node_screen toneIndigo
```

## Components

### Desktop interfaces

- [Qt desktop](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/qt_ui.py): `src/room_brightness/qt_ui.py`
- [Curve editor](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/comfort_ui.py): `src/room_brightness/comfort_ui.py`
- [Calibration tools](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/tuning_ui.py): `src/room_brightness/tuning_ui.py`
- [Display and suggestions](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/review_ui.py): `src/room_brightness/review_ui.py`

### Capture and control

- [Control engine](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/qt_engine.py): `src/room_brightness/qt_engine.py`
- [Camera capture](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/camera.py): `src/room_brightness/camera.py`
- [Image metering](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/metering.py): `src/room_brightness/metering.py`
- [Display brightness](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/brightness.py): `src/room_brightness/brightness.py`

### Adaptation and safeguards

- [Adaptive controller](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/adaptive.py): `src/room_brightness/adaptive.py`
- [Curve and stability](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/comfort.py): `src/room_brightness/comfort.py`
- [Quality safeguards](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/quality.py): `src/room_brightness/quality.py`
- [Image analysis](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/vision.py): `src/room_brightness/vision.py`
- [Power and trials](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/experience.py): `src/room_brightness/experience.py`
- [Recovery diagnostics](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/recovery.py): `src/room_brightness/recovery.py`

### Settings and tools

- [Persistent settings](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/settings.py): `src/room_brightness/settings.py`
- [Languages](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/i18n.py): `src/room_brightness/i18n.py`
- [Themes](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/themes.py): `src/room_brightness/themes.py`
- [Profiles and updates](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/extras.py): `src/room_brightness/extras.py`
- [Calibration and performance](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/tuning.py): `src/room_brightness/tuning.py`

### Linux preview

- [Linux monitor CLI](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/linux_control.py): `src/room_brightness/linux_control.py`
- [Linux desktop preview](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/linux_ui.py): `src/room_brightness/linux_ui.py`
- [Linux restore helper](https://github.com/bassam-alomari/auto-brightness/blob/main/src/room_brightness/linux_backup.py): `src/room_brightness/linux_backup.py`

### Other components

- **User**
- **Camera device**
- **Display device**

## Connections

- User → Qt desktop: starts monitoring (evidence: `README.md`)
- Qt desktop → Control engine: controls (evidence: `src/room_brightness/qt_ui.py`)
- Control engine → Persistent settings: loads and saves (evidence: `src/room_brightness/qt_engine.py`)
- Control engine → Camera capture: selects camera (evidence: `src/room_brightness/qt_engine.py`)
- Camera capture → Camera device: captures from (evidence: `README.md`)
- Camera capture → Image metering: meters samples (evidence: `src/room_brightness/camera.py`)
- Image metering → Quality safeguards: checks quality (evidence: `src/room_brightness/metering.py`)
- Adaptive controller → Quality safeguards: gates readings (evidence: `src/room_brightness/adaptive.py`)
- Adaptive controller → Curve and stability: uses stability rules (evidence: `src/room_brightness/adaptive.py`)
- Adaptive controller → Image analysis: uses image targets (evidence: `src/room_brightness/adaptive.py`)
- Control engine → Display brightness: controls brightness
- Display brightness → Display device: reads and writes (evidence: `README.md`)
- Power and trials → Adaptive controller: calculates targets (evidence: `src/room_brightness/experience.py`)
- Power and trials → Recovery diagnostics: builds reports (evidence: `src/room_brightness/experience.py`)
- Persistent settings → Languages: resolves language (evidence: `src/room_brightness/settings.py`)
- Persistent settings → Themes: validates theme (evidence: `src/room_brightness/settings.py`)
- Persistent settings → Profiles and updates: validates profiles (evidence: `src/room_brightness/settings.py`)
- Persistent settings → Calibration and performance: validates options (evidence: `src/room_brightness/settings.py`)
- Qt desktop → Curve editor: opens editor (evidence: `src/room_brightness/qt_ui.py`)
- Qt desktop → Calibration tools: opens tools (evidence: `src/room_brightness/qt_ui.py`)
- Qt desktop → Display and suggestions: opens review (evidence: `src/room_brightness/qt_ui.py`)
- User → Linux monitor CLI: runs preview (evidence: `README.md`)
- User → Linux desktop preview: opens preview (evidence: `README.md`)
- Linux monitor CLI → Adaptive controller: uses adaptation (evidence: `src/room_brightness/linux_control.py`)
- Linux monitor CLI → Image metering: uses metering (evidence: `src/room_brightness/linux_control.py`)
- Linux monitor CLI → Persistent settings: loads preferences (evidence: `src/room_brightness/linux_control.py`)
- Linux desktop preview → Linux monitor CLI: uses control (evidence: `src/room_brightness/linux_ui.py`)
- Linux desktop preview → Linux restore helper: uses restore helper (evidence: `src/room_brightness/linux_ui.py`)
- Linux desktop preview → Recovery diagnostics: uses diagnostics (evidence: `src/room_brightness/linux_ui.py`)
