# vijaidjearam/uwf-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/vijaidjearam/uwf-monitor
- Repository: https://github.com/vijaidjearam/uwf-monitor

## Overview

#### Purpose and Entry Point
This is a Windows-only, background system-tray monitor for Unified Write Filter (UWF). Its sole application entry point is `uwf_tray_monitor.py`, which is run directly with Python or packaged as a windowless executable.

#### Application Shell and UI
`uwf_tray_monitor.py` hosts the PyQt5 application lifecycle and system-tray integration. It creates a tray icon, maintains tooltip text, and exposes a context menu for manual refresh, detailed UWF information, and exit. There is no web server, persistent datastore, or multi-process application backend.

#### UWF Status Collection
The monitor invokes the Windows UWF management CLI, `uwfmgr.exe`, through subprocess calls:
- `uwfmgr.exe get-config` determines whether the filter is enabled.
- `uwfmgr.exe volume get-config c:` determines whether the C: volume is protected.

These commands require Windows 10/11 with UWF installed and normally administrator privileges. Their UTF-16 output is decoded before status parsing. Console-suppression flags prevent command windows from appearing.

#### Status Evaluation Boundary
Within `uwf_tray_monitor.py`, command output is parsed into two independent signals: filter state and volume-protection state. The overall protected state is true only when both are true; failures, disabled filter state, or an unprotected C: volume resolve to the unprotected condition. This keeps external CLI output isolated from UI state.

#### Refresh and Control Flow
A periodic Qt timer triggers status collection every five seconds. The same refresh path is reused by the context-menu refresh action. The resulting state updates the tray icon color and tooltip; detailed-status UI uses the collected configuration information. Exit terminates the Qt event loop and monitor process.

#### Runtime and Packaging
The runtime is Python 3.7+ on Windows with PyQt5, declared in `requirements.txt`. The intended deployment artifact is a PyInstaller one-file, windowless executable built from `uwf_tray_monitor.py`. GitHub Actions release automation is defined in `.github/workflows/build-release.yml`, likely providing the build/release boundary for distributable binaries.

Main entry points: [`uwf_tray_monitor.py`](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py) (UWF status collection), [`requirements.txt`](https://github.com/vijaidjearam/uwf-monitor/blob/main/requirements.txt) (Python dependencies), [`.github/workflows/build-release.yml`](https://github.com/vijaidjearam/uwf-monitor/blob/main/.github/workflows/build-release.yml) (Release build workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Windows Runtime"]
  node_windows["Windows 10/11 + UWF<br/>platform"]
  node_uwfmgr{{"uwfmgr.exe<br/>UWF management CLI"}}
end

subgraph group_app["Tray Monitor"]
  node_entry["Application entry point<br/>Python application"]
  node_qt_timer(("Periodic refresh timer<br/>Qt timer"))
  node_tray_ui["System tray UI<br/>PyQt5 tray integration"]
  node_manual_refresh["Manual refresh action<br/>tray menu action"]
  node_status_collection["UWF status collection<br/>subprocess adapter"]
  node_filter_config["Filter configuration<br/>CLI result"]
  node_volume_config["C: volume configuration<br/>CLI result"]
  node_status_evaluation["Protection state evaluation<br/>status parser"]
  node_details_ui["Detailed status UI<br/>tray menu view"]
  node_exit_action["Exit action<br/>tray menu action"]
end

subgraph group_delivery["Build &amp; Release"]
  node_requirements["Python dependencies<br/>runtime manifest<br/>[requirements.txt]"]
  node_pyinstaller["PyInstaller executable<br/>deployment artifact"]
  node_release_workflow["Release build workflow<br/>GitHub Actions workflow<br/>[build-release.yml]"]
end

node_windows -->|"provides"| node_uwfmgr
node_entry -->|"creates"| node_tray_ui
node_entry -->|"starts"| node_qt_timer
node_qt_timer -->|"every 5 seconds"| node_status_collection
node_manual_refresh -->|"reuses refresh path"| node_status_collection
node_tray_ui -->|"exposes"| node_manual_refresh
node_status_collection -->|"invokes subprocess commands"| node_uwfmgr
node_status_collection -->|"get-config"| node_filter_config
node_status_collection -->|"volume get-config c:"| node_volume_config
node_filter_config -->|"filter signal"| node_status_evaluation
node_volume_config -->|"volume signal"| node_status_evaluation
node_status_evaluation -->|"updates icon and tooltip"| node_tray_ui
node_status_collection -->|"supplies configuration"| node_details_ui
node_tray_ui -->|"opens"| node_details_ui
node_tray_ui -->|"exposes"| node_exit_action
node_exit_action -->|"stops event loop"| node_entry
node_requirements -.->|"supplies PyQt5 runtime"| node_entry
node_entry -->|"packaged as"| node_pyinstaller
node_release_workflow -->|"builds and releases"| node_pyinstaller

click node_entry "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_qt_timer "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_tray_ui "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_manual_refresh "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_status_collection "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_filter_config "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_volume_config "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_status_evaluation "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_details_ui "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_exit_action "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_requirements "https://github.com/vijaidjearam/uwf-monitor/blob/main/requirements.txt"
click node_pyinstaller "https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py"
click node_release_workflow "https://github.com/vijaidjearam/uwf-monitor/blob/main/.github/workflows/build-release.yml"

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_windows,node_uwfmgr toneBlue
class node_entry,node_qt_timer,node_tray_ui,node_manual_refresh,node_status_collection,node_filter_config,node_volume_config,node_status_evaluation,node_details_ui,node_exit_action toneAmber
class node_requirements,node_pyinstaller,node_release_workflow toneMint
```

## Components

### Windows Runtime

Windows 10/11 host with UWF installed.

- **Windows 10/11 + UWF**: platform · UWF commands normally require administrator privileges.
- **uwfmgr.exe**: UWF management CLI

### Tray Monitor

- [Application entry point](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): Python application · Hosts the PyQt lifecycle and monitor process. · `uwf_tray_monitor.py`
- [Periodic refresh timer](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): Qt timer · Triggers collection every five seconds. · `uwf_tray_monitor.py`
- [System tray UI](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): PyQt5 tray integration · Provides icon, tooltip, and context menu. · `uwf_tray_monitor.py`
- [Manual refresh action](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): tray menu action · `uwf_tray_monitor.py`
- [UWF status collection](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): subprocess adapter · Runs hidden CLI commands and decodes UTF-16 output. · `uwf_tray_monitor.py`
- [Filter configuration](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): CLI result · Collected with get-config. · `uwf_tray_monitor.py`
- [C: volume configuration](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): CLI result · Collected with volume get-config c:. · `uwf_tray_monitor.py`
- [Protection state evaluation](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): status parser · Protected only when filter and C: protection are both enabled. · `uwf_tray_monitor.py`
- [Detailed status UI](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): tray menu view · Shows collected UWF configuration information. · `uwf_tray_monitor.py`
- [Exit action](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): tray menu action · Terminates the Qt event loop. · `uwf_tray_monitor.py`

### Build & Release

- [Python dependencies](https://github.com/vijaidjearam/uwf-monitor/blob/main/requirements.txt): runtime manifest · Declares Python 3.7+ and PyQt5 requirements. · `requirements.txt`
- [PyInstaller executable](https://github.com/vijaidjearam/uwf-monitor/blob/main/uwf_tray_monitor.py): deployment artifact · One-file, windowless Windows executable. · `uwf_tray_monitor.py`
- [Release build workflow](https://github.com/vijaidjearam/uwf-monitor/blob/main/.github/workflows/build-release.yml): GitHub Actions workflow · Builds and releases distributable binaries. · `.github/workflows/build-release.yml`

## Connections

- Windows 10/11 + UWF → uwfmgr.exe: provides
- Application entry point → System tray UI: creates
- Application entry point → Periodic refresh timer: starts
- Periodic refresh timer → UWF status collection: every 5 seconds
- Manual refresh action → UWF status collection: reuses refresh path
- System tray UI → Manual refresh action: exposes
- UWF status collection → uwfmgr.exe: invokes subprocess commands
- UWF status collection → Filter configuration: get-config
- UWF status collection → C: volume configuration: volume get-config c:
- Filter configuration → Protection state evaluation: filter signal
- C: volume configuration → Protection state evaluation: volume signal
- Protection state evaluation → System tray UI: updates icon and tooltip
- UWF status collection → Detailed status UI: supplies configuration
- System tray UI → Detailed status UI: opens
- System tray UI → Exit action: exposes
- Exit action → Application entry point: stops event loop
- Python dependencies → Application entry point: supplies PyQt5 runtime
- Application entry point → PyInstaller executable: packaged as
- Release build workflow → PyInstaller executable: builds and releases
