# mlohajner/wifi-spectrum architecture

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

- Interactive diagram: https://gitdiagram.com/mlohajner/wifi-spectrum
- Repository: https://github.com/mlohajner/wifi-spectrum

## Overview

WiFi-spectrum is a native Linux WiFi spectrum visualizer; scan2 adds Bluetooth visualization. The main workflow is to scan nearby radios, parse results, and display them in an embedded WebKitGTK interface, with GTK handling native dialogs and NetworkManager connections. The README documents the broader feature set; sampled excerpts confirm scanning, parsing, UI behavior, and GTK-to-WebKit messaging, but omit much of the runtime wiring. Edges based on the README reflect documented behavior, not a full source trace.

Main entry points: [`source/scan.py`](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py) (Embedded WebKit view), [`source/scan2.py`](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py) (WiFi + BT scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Radio acquisition"]
  node_scan_app["WiFi scanner<br/>[scan.py]"]
  node_wifi_scan["WiFi scan<br/>[scan.py]"]
  node_wifi_parse["WiFi parsing<br/>[scan.py]"]
  node_bt_scan_app["WiFi + BT scanner<br/>[scan2.py]"]
  node_bt_scan["Bluetooth results<br/>[scan2.py]"]
end

subgraph group_presentation["Visualization"]
  node_web_view["Embedded WebKit view<br/>[scan.py]"]
  node_spectrum["Spectrum graph<br/>[scan.py]"]
  node_network_table["Network table<br/>[scan.py]"]
  node_bt_view["Bluetooth visualization<br/>[scan2.py]"]
  node_theme["Theme styling<br/>[scan.py]"]
end

subgraph group_desktop["Desktop integration"]
  node_gtk["GTK window and dialogs<br/>[scan.py]"]
  node_connection["Connection flow<br/>[scan.py]"]
  node_radio_status["Radio status controls<br/>[scan.py]"]
  node_settings["Settings<br/>[scan2.py]"]
end

node_user(("User"))
node_networkmanager["NetworkManager"]
node_rfkill["rfkill and interface tools"]

node_user -->|"launches"| node_scan_app
node_user -->|"launches"| node_bt_scan_app
node_scan_app -->|"runs scan"| node_wifi_scan
node_wifi_scan -->|"parses results"| node_wifi_parse
node_scan_app -->|"feeds data"| node_web_view
node_web_view -->|"renders"| node_spectrum
node_web_view -->|"renders"| node_network_table
node_user -->|"selects network"| node_network_table
node_bt_scan_app -->|"scans devices"| node_bt_scan
node_bt_scan_app -->|"feeds data"| node_bt_view
node_web_view -->|"uses styles"| node_theme
node_user -->|"uses dialogs"| node_gtk
node_web_view -->|"requests connect"| node_gtk
node_gtk -->|"prompts"| node_connection
node_connection -->|"connects via"| node_networkmanager
node_scan_app -->|"checks status"| node_radio_status
node_radio_status -->|"checks or unblocks"| node_rfkill
node_user -->|"configures"| node_settings
node_settings -->|"sets preference"| node_theme

click node_scan_app "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_wifi_scan "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_wifi_parse "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_bt_scan_app "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py"
click node_bt_scan "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py"
click node_web_view "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_spectrum "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_network_table "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_bt_view "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py"
click node_theme "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_gtk "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_connection "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_radio_status "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py"
click node_settings "https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.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_scan_app,node_wifi_scan,node_wifi_parse,node_bt_scan_app,node_bt_scan,node_user toneBlue
class node_web_view,node_spectrum,node_network_table,node_bt_view,node_theme toneAmber
class node_gtk,node_connection,node_radio_status,node_settings toneMint
class node_networkmanager,node_rfkill toneIndigo
```

## Components

### Radio acquisition

- [WiFi scanner](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [WiFi scan](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [WiFi parsing](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [WiFi + BT scanner](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py): `source/scan2.py`
- [Bluetooth results](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py): `source/scan2.py`

### Visualization

- [Embedded WebKit view](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [Spectrum graph](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [Network table](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [Bluetooth visualization](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py): `source/scan2.py`
- [Theme styling](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`

### Desktop integration

- [GTK window and dialogs](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [Connection flow](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [Radio status controls](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan.py): `source/scan.py`
- [Settings](https://github.com/mlohajner/wifi-spectrum/blob/main/source/scan2.py): `source/scan2.py`

### Other components

- **User**
- **NetworkManager**
- **rfkill and interface tools**

## Connections

- User → WiFi scanner: launches (evidence: `README.md`)
- User → WiFi + BT scanner: launches (evidence: `README.md`)
- WiFi scanner → WiFi scan: runs scan (evidence: `source/scan.py`)
- WiFi scan → WiFi parsing: parses results (evidence: `README.md`)
- WiFi scanner → Embedded WebKit view: feeds data (evidence: `README.md`)
- Embedded WebKit view → Spectrum graph: renders (evidence: `README.md`)
- Embedded WebKit view → Network table: renders (evidence: `README.md`)
- User → Network table: selects network (evidence: `README.md`)
- WiFi + BT scanner → Bluetooth results: scans devices (evidence: `README.md`)
- WiFi + BT scanner → Bluetooth visualization: feeds data (evidence: `README.md`)
- Embedded WebKit view → Theme styling: uses styles (evidence: `README.md`)
- User → GTK window and dialogs: uses dialogs (evidence: `README.md`)
- Embedded WebKit view → GTK window and dialogs: requests connect (evidence: `source/scan.py`)
- GTK window and dialogs → Connection flow: prompts (evidence: `README.md`)
- Connection flow → NetworkManager: connects via (evidence: `README.md`)
- WiFi scanner → Radio status controls: checks status (evidence: `README.md`)
- Radio status controls → rfkill and interface tools: checks or unblocks (evidence: `source/scan.py`)
- User → Settings: configures (evidence: `README.md`)
- Settings → Theme styling: sets preference (evidence: `README.md`)
