# mbrizic/i3win architecture

> Architecture diagram of the GitHub repository mbrizic/i3win, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mbrizic/i3win
- Repository: https://github.com/mbrizic/i3win

## Overview

##### Project Type Analysis
This is a Windows system utility application that interfaces directly with the Win32 API to manage window layouts and behaviors, similar to the i3 window manager from Linux. It's a standalone desktop application written in C++.

##### Main Components

A. Core System Components:
- Window Management System (window.h/cpp)
- Layout Engine (layouts.h/cpp)
- Configuration System (config.h/cpp)
- State Management (state.h/cpp)
- Screen Management (screen.h/cpp)
- Environment Handler (environment.h/cpp)
- Logging System (logger.h/cpp)

B. External Dependencies:
- Win32 API
- Windows Desktop Environment

**Top Layer: User Interface Layer**

**Middle Layer: Core Management Layer**

**Bottom Layer: System Interface Layer**

##### Component Relationships

a) User Interface Layer:
- Managed application windows
- To the Window Management component

b) Core Management Layer (Main Application Logic):
- Window Manager Component
- Layout Engine Component
- State Manager Component
- Screen Manager Component

c) System Interface Layer:
- Win32 API Interface
- Configuration System
- Environment Handler
- Logging System

##### Key Relationships to Highlight

- How the Window Manager interfaces with Win32 API
- Layout Engine's relationship with Window Manager
- Demonstrate the Configuration System's influence on other components
- State Manager's role in maintaining window arrangements
- How the Logger interfaces with all components

##### Implementation Details

- Entry point (main.cpp)
- Configuration file parsing flow
- Logging paths
- Screen and window state management flow

Remember to:
- Keep the main workflow clear and visible
- Brief notes for key interaction points
- Error handling and logging paths
- Version or build information

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef uiLayer fill:#a8d1f0,stroke:#333
    classDef coreLayer fill:#90EE90,stroke:#333
    classDef systemLayer fill:#FFE5B4,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333

    %% User Interface Layer
    subgraph UI
        ManagedWindows["Managed Application Windows"]:::uiLayer
    end

    %% Core Management Layer
    subgraph Core
        WindowManager["Window Manager"]:::coreLayer
        LayoutEngine["Layout Engine"]:::coreLayer
        StateManager["State Manager"]:::coreLayer
        ScreenManager["Screen Manager"]:::coreLayer
    end

    %% System Interface Layer
    subgraph System
        Win32["Win32 API Interface"]:::systemLayer
        ConfigSystem["Configuration System"]:::systemLayer
        EnvHandler["Environment Handler"]:::systemLayer
        Logger["Logging System"]:::systemLayer
    end

    %% External Systems
    subgraph External
        WinDesktop["Windows Desktop Environment"]:::external
        ConfigFile["i3win.conf"]:::external
    end

    %% Relationships
    ManagedWindows --> WindowManager
    WindowManager --> Win32
    Win32 --> WinDesktop
    
    WindowManager <--> LayoutEngine
    WindowManager <--> StateManager
    WindowManager <--> ScreenManager
    
    ConfigFile --> ConfigSystem
    ConfigSystem --> WindowManager
    ConfigSystem --> LayoutEngine
    
    EnvHandler --> WindowManager
    EnvHandler --> ConfigSystem
    
    Logger -.-> WindowManager
    Logger -.-> LayoutEngine
    Logger -.-> StateManager
    Logger -.-> ScreenManager
    Logger -.-> ConfigSystem

    %% Click Events
    click WindowManager "https://github.com/mbrizic/i3win/blob/master/src/window.h"
    click LayoutEngine "https://github.com/mbrizic/i3win/blob/master/src/layouts.h"
    click ConfigSystem "https://github.com/mbrizic/i3win/blob/master/src/config.h"
    click StateManager "https://github.com/mbrizic/i3win/blob/master/src/state.h"
    click ScreenManager "https://github.com/mbrizic/i3win/blob/master/src/screen.h"
    click EnvHandler "https://github.com/mbrizic/i3win/blob/master/src/environment.h"
    click Logger "https://github.com/mbrizic/i3win/blob/master/src/logger.h"
    click ConfigFile "https://github.com/mbrizic/i3win/blob/master/config/i3win.conf"

    %% Legend
    subgraph Legend
        UI_Legend["User Interface Layer"]:::uiLayer
        Core_Legend["Core Management Layer"]:::coreLayer
        System_Legend["System Interface Layer"]:::systemLayer
        External_Legend["External Systems"]:::external
    end
```
