# suntzv/pratibimb architecture

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

- Interactive diagram: https://gitdiagram.com/suntzv/pratibimb
- Repository: https://github.com/suntzv/pratibimb

## Overview

1. **Repository shape**
   - This is a Windows-only Chromium extension project with three deployable pieces:
     - the **browser extension** under `extension/`
     - the **native Windows host** under `host/`
     - the **installer** under `install/`
   - The top-level `extension.zip` and `install/Pratibimb_Setup.exe` are packaged artifacts, not core source.

2. **Primary goal**
   - Pratibimb’s architecture is built around one key boundary: **Chromium UI in the browser** versus **wallpaper access on Windows**.
   - The extension cannot read the desktop wallpaper directly, so it depends on a small native program to bridge that gap.

3. **Browser extension subsystem**
   - `extension/manifest.json` defines the Chrome/Edge/Chromium extension.
   - `newtab.html` + `newtab.js` implement the custom New Tab experience.
   - `customize.html` + `customize.js` implement the settings/customization surface.
   - `ui.js` appears to hold shared UI behavior for the extension pages.
   - `fastload.js` likely exists to make the New Tab page render quickly and avoid a blank flash before wallpaper-driven styling is applied.

4. **Wallpaper-to-UI data flow**
   - The native host reads the current Windows wallpaper and passes that information into the extension.
   - The New Tab page then uses that wallpaper as the visual input for the entire UI theme: background, glassmorphism, lighting, and overall mood.
   - The readme emphasizes that this is **live** and **not polling-based**, so the host is probably invoked or queried only when needed, rather than running a constant watcher loop.

5. **Native host subsystem**
   - `host/main.cpp` is the Windows-side bridge.
   - It is responsible for extracting wallpaper information from the OS and speaking the Chromium native messaging protocol.
   - `host/pratibimb_host.exe` is the compiled host binary expected to be registered with the browser.
   - `stb_image.h` and `stb_image_write.h` suggest the host may also decode or re-encode image data, not just forward file paths.

6. **Installer subsystem**
   - `install/installer.cpp` is the setup program that automates the annoying parts:
     - extracting files into AppData/local install locations
     - registering the native messaging host with Windows/Chromium
     - linking the browser extension ID to the native host
   - `install/resources.rc` and `install/resources.res` indicate the installer has embedded UI/resources.

7. **Installation boundary**
   - The readme’s manual steps match the architecture:
     - install the extension folder in the browser
     - copy the extension ID back into the installer
     - let the installer wire up the native host
   - That means the extension and host are loosely coupled through browser registration rather than being bundled as a single monolithic app.

8. **Runtime integration model**
   - The browser extension is the always-visible front end.
   - The native host is the privileged Windows bridge.
   - Communication is indirect and sandbox-safe: the extension requests wallpaper data through Chromium’s native messaging mechanism, and the host returns the current wallpaper payload.

9. **Customization surface**
   - The presence of `customize.html/js` implies the extension exposes configuration separate from the New Tab page.
   - This likely covers visual or behavior options that alter how the wallpaper is interpreted or how the New Tab UI responds to it.
   - From an architecture perspective, customization stays inside the extension boundary; it does not require changes to the Windows host.

10. **Assets and presentation layer**
   - `assets/`, `extension/icons/`, and `extension/fonts/` support the visual identity of the New Tab UI and installer.
   - The repo is heavily presentation-driven: the wallpaper is not just a background image but the input to the page’s style system.

11. **Platform and browser constraints**
   - The system is explicitly tied to **Windows** because the wallpaper source is Windows desktop state.
   - It targets **Chromium-based browsers** that support native messaging and unpacked extension installation.
   - The readme notes browser and Defender limitations, which are important operational constraints of the architecture.

12. **What to diagram**
   - A good architecture diagram would show:
     - Windows wallpaper source
     - native host bridge (`host/main.cpp` / `pratibimb_host.exe`)
     - Chromium extension (`manifest.json`, `newtab`, `customize`, shared UI)
     - installer as the provisioning step that registers the bridge and installs files
   - The key flow is: **Windows wallpaper → native host → extension → themed New Tab UI**.

Main entry points: [`install/installer.cpp`](https://github.com/suntzv/pratibimb/blob/main/install/installer.cpp) (Installer), [`host/main.cpp`](https://github.com/suntzv/pratibimb/blob/main/host/main.cpp) (Host Main), [`extension/newtab.js`](https://github.com/suntzv/pratibimb/blob/main/extension/newtab.js) (New Tab JS), [`extension/customize.js`](https://github.com/suntzv/pratibimb/blob/main/extension/customize.js) (Customize JS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_extension["Browser Extension"]
  node_ext_manifest["Manifest<br/>extension config<br/>[manifest.json]"]
  node_newtab_page["New Tab<br/>page<br/>[newtab.html]"]
  node_newtab_logic["New Tab JS<br/>ui logic<br/>[newtab.js]"]
  node_fastload["Fast Load<br/>startup script<br/>[fastload.js]"]
  node_customize_page["Customize<br/>settings page<br/>[customize.html]"]
  node_customize_logic["Customize JS<br/>settings logic<br/>[customize.js]"]
  node_shared_ui["Shared UI<br/>ui helpers<br/>[ui.js]"]
  node_wallpaper_theme{{"Wallpaper Theme<br/>visual system"}}
end

subgraph group_g_host["Native Host"]
  node_host_main["Host Main<br/>windows bridge<br/>[main.cpp]"]
  node_host_binary["Host EXE<br/>compiled host<br/>[pratibimb_host.exe]"]
  node_stb_image["Image Decode<br/>image libs<br/>[stb_image.h]"]
end

subgraph group_g_installer["Installer"]
  node_installer_main["Installer<br/>setup program<br/>[installer.cpp]"]
  node_installer_ui["Installer Resources<br/>embedded resources<br/>[resources.rc]"]
  node_install_package["Setup EXE<br/>packaged installer"]
end

subgraph group_g_assets["Assets"]
  node_presentation_assets["Presentation Assets"]
end

node_windows_wallpaper[("Windows Wallpaper<br/>OS source")]
node_native_messaging["Native Messaging<br/>bridge protocol"]

node_windows_wallpaper -->|"reads"| node_host_main
node_host_main -->|"responds via"| node_native_messaging
node_ext_manifest -->|"declares"| node_native_messaging
node_newtab_page -->|"uses"| node_newtab_logic
node_newtab_page -->|"boots with"| node_fastload
node_newtab_logic -->|"shares"| node_shared_ui
node_customize_page -->|"uses"| node_customize_logic
node_customize_logic -->|"shares"| node_shared_ui
node_newtab_logic -->|"builds"| node_wallpaper_theme
node_customize_logic -->|"adjusts"| node_wallpaper_theme
node_host_main -->|"depends on"| node_stb_image
node_host_main -->|"builds"| node_host_binary
node_installer_main -->|"installs"| node_host_binary
node_installer_main -->|"registers"| node_ext_manifest
node_installer_main -->|"packages"| node_installer_ui
node_installer_main -->|"builds"| node_install_package
node_presentation_assets -->|"supports"| node_newtab_page
node_presentation_assets -->|"supports"| node_customize_page

click node_ext_manifest "https://github.com/suntzv/pratibimb/blob/main/extension/manifest.json"
click node_newtab_page "https://github.com/suntzv/pratibimb/blob/main/extension/newtab.html"
click node_newtab_logic "https://github.com/suntzv/pratibimb/blob/main/extension/newtab.js"
click node_fastload "https://github.com/suntzv/pratibimb/blob/main/extension/fastload.js"
click node_customize_page "https://github.com/suntzv/pratibimb/blob/main/extension/customize.html"
click node_customize_logic "https://github.com/suntzv/pratibimb/blob/main/extension/customize.js"
click node_shared_ui "https://github.com/suntzv/pratibimb/blob/main/extension/ui.js"
click node_host_main "https://github.com/suntzv/pratibimb/blob/main/host/main.cpp"
click node_host_binary "https://github.com/suntzv/pratibimb/blob/main/host/pratibimb_host.exe"
click node_stb_image "https://github.com/suntzv/pratibimb/blob/main/host/stb_image.h"
click node_installer_main "https://github.com/suntzv/pratibimb/blob/main/install/installer.cpp"
click node_installer_ui "https://github.com/suntzv/pratibimb/blob/main/install/resources.rc"
click node_install_package "https://github.com/suntzv/pratibimb/blob/main/install/Pratibimb_Setup.exe"
click node_presentation_assets "https://github.com/suntzv/pratibimb/tree/main/assets"

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_ext_manifest,node_newtab_page,node_newtab_logic,node_fastload,node_customize_page,node_customize_logic,node_shared_ui,node_wallpaper_theme toneBlue
class node_host_main,node_host_binary,node_stb_image toneAmber
class node_installer_main,node_installer_ui,node_install_package toneMint
class node_presentation_assets toneRose
class node_windows_wallpaper,node_native_messaging toneNeutral
```

## Components

### Browser Extension

Chromium extension UI and theming surface

- [Manifest](https://github.com/suntzv/pratibimb/blob/main/extension/manifest.json): extension config · Declares the Chromium extension and permissions · `extension/manifest.json`
- [New Tab](https://github.com/suntzv/pratibimb/blob/main/extension/newtab.html): page · Custom new tab experience · `extension/newtab.html`
- [New Tab JS](https://github.com/suntzv/pratibimb/blob/main/extension/newtab.js): ui logic · Wallpaper-driven rendering and page behavior · `extension/newtab.js`
- [Fast Load](https://github.com/suntzv/pratibimb/blob/main/extension/fastload.js): startup script · Avoids blank flash before theming applies · `extension/fastload.js`
- [Customize](https://github.com/suntzv/pratibimb/blob/main/extension/customize.html): settings page · User customization surface · `extension/customize.html`
- [Customize JS](https://github.com/suntzv/pratibimb/blob/main/extension/customize.js): settings logic · Handles customization interactions and options · `extension/customize.js`
- [Shared UI](https://github.com/suntzv/pratibimb/blob/main/extension/ui.js): ui helpers · Common extension UI behavior · `extension/ui.js`
- **Wallpaper Theme**: visual system · Turns wallpaper input into background, lighting, and glassmorphism

### Native Host

Windows bridge that reads wallpaper and speaks native messaging

- [Host Main](https://github.com/suntzv/pratibimb/blob/main/host/main.cpp): windows bridge · Reads wallpaper and responds over native messaging · `host/main.cpp`
- [Host EXE](https://github.com/suntzv/pratibimb/blob/main/host/pratibimb_host.exe): compiled host · Registered native messaging executable · `host/pratibimb_host.exe`
- [Image Decode](https://github.com/suntzv/pratibimb/blob/main/host/stb_image.h): image libs · Embedded image decoding and writing support · `host/stb_image.h`

### Installer

Provisioning and registration tooling

- [Installer](https://github.com/suntzv/pratibimb/blob/main/install/installer.cpp): setup program · Installs files and registers the native host · `install/installer.cpp`
- [Installer Resources](https://github.com/suntzv/pratibimb/blob/main/install/resources.rc): embedded resources · Installer UI assets and resource definitions · `install/resources.rc`
- [Setup EXE](https://github.com/suntzv/pratibimb/blob/main/install/Pratibimb_Setup.exe): packaged installer · Built installer artifact · `install/Pratibimb_Setup.exe`

### Assets

Shared presentation resources

- [Presentation Assets](https://github.com/suntzv/pratibimb/tree/main/assets): assets · Icons, fonts, and other visual resources · `assets`

### Other components

- **Windows Wallpaper**: OS source · Current desktop wallpaper state on Windows
- **Native Messaging**: bridge protocol · Chromium native messaging channel between extension and host

## Connections

- Windows Wallpaper → Host Main: reads · Native host extracts the current wallpaper from Windows
- Host Main → Native Messaging: responds via · Host returns wallpaper payloads over Chromium native messaging
- Manifest → Native Messaging: declares · Extension is configured to talk to the native host
- New Tab → New Tab JS: uses · Page loads its behavior script
- New Tab → Fast Load: boots with · Fast-load script prepares the page before full theming
- New Tab JS → Shared UI: shares · New Tab reuses common UI behavior
- Customize → Customize JS: uses · Settings page loads its controller script
- Customize JS → Shared UI: shares · Customization UI uses shared helpers
- New Tab JS → Wallpaper Theme: builds · Wallpaper data is transformed into the themed interface
- Customize JS → Wallpaper Theme: adjusts · Customization changes how wallpaper-driven theming behaves
- Host Main → Image Decode: depends on · Host includes image processing helpers
- Host Main → Host EXE: builds · Source compiles into the registered host executable
- Installer → Host EXE: installs · Installer deploys the native host binary
- Installer → Manifest: registers · Installer wires the extension ID to the native host
- Installer → Installer Resources: packages · Installer embeds resources and UI definitions
- Installer → Setup EXE: builds · Source compiles into the setup executable
- Presentation Assets → New Tab: supports · Icons/fonts contribute to the extension presentation
- Presentation Assets → Customize: supports · Shared visual assets also support settings UI
