# instantos/instantwm architecture

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

- Interactive diagram: https://gitdiagram.com/instantos/instantwm
- Repository: https://github.com/instantos/instantwm

## Overview

##### Main Components Structure

a) Window Management Core
- Components from instantwm.c and instantwm.h
- To layout management (layouts.c, layouts.h)

b) Drawing System
- This as a supporting module
- Components from drw.c and drw.h
- Connection to the theming system

c) Layout Engine
- This as a major subsystem
- Layouts.c and layouts.h
- Interaction with window management core

d) Utility Layer
- At the bottom as a foundation
- Util.c and util.h
- Connections to other components

##### Key Interactions

- Window Management → Drawing System (window rendering)
- Window Management → Layout Engine (window positioning)
- Theme System → Drawing System (appearance configuration)
- Control Interface → Window Management (instantwmctrl.sh integration)

##### Special Features Layer
- Overlay System
- Animation Engine
- Tag Management
- Multi-monitor Support
- Start Menu Interface

##### Configuration System
How these components interact:
- config.def.h
- Theme files (themes/*.theme)
- config.mk

- Blue: Core window management
- Green: Drawing and visual components
- Orange: Layout management
- Purple: Configuration and theming
- Gray: Utility functions

##### Core Components (Center)
**[Window Management Core]**
- ↑
**[Layout Engine] ← → [Drawing System]**
- ↑               ↑
**[Utility Layer] → [Theme System]**

##### Feature Modules (Right Side)
**[Overlay System]**
**[Animation Engine]   → [Window Management Core]**
**[Tag Management]**
**[Multi-monitor]**

##### Configuration (Left Side)
**[config.def.h]**
**[Theme Files]    → [Theme System]**
**[config.mk]**

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core
        WMCore["Window Management Core"]
        LayoutEngine["Layout Engine"]
        DrawSystem["Drawing System"]
        UtilLayer["Utility Layer"]
        ThemeSystem["Theme System"]
    end

    subgraph Features
        Overlay["Overlay System"]
        Animation["Animation Engine"]
        TagMgmt["Tag Management"]
        MultiMon["Multi-monitor Support"]
        PushSystem["Window Push System"]
    end

    subgraph Config
        ConfigDef["Configuration Definition"]
        ThemeFiles["Theme Files"]
        ConfigMK["Build Configuration"]
        CtrlInterface["Control Interface"]
    end

    %% Core Relationships
    WMCore <--> LayoutEngine
    WMCore <--> DrawSystem
    LayoutEngine <--> DrawSystem
    UtilLayer --> WMCore
    UtilLayer --> LayoutEngine
    UtilLayer --> DrawSystem
    ThemeSystem --> DrawSystem

    %% Feature Relationships
    Overlay --> WMCore
    Animation --> WMCore
    TagMgmt --> WMCore
    MultiMon --> WMCore
    PushSystem --> WMCore

    %% Config Relationships
    ConfigDef --> WMCore
    ThemeFiles --> ThemeSystem
    ConfigMK --> WMCore
    CtrlInterface --> WMCore

    %% Styling
    classDef core fill:#2b6cb0,stroke:#1a4971,color:#fff
    classDef feature fill:#38a169,stroke:#2f855a,color:#fff
    classDef config fill:#d69e2e,stroke:#b7791f,color:#fff
    classDef util fill:#718096,stroke:#4a5568,color:#fff
    classDef theme fill:#805ad5,stroke:#6b46c1,color:#fff

    %% Apply styles
    class WMCore,LayoutEngine,DrawSystem core
    class Overlay,Animation,TagMgmt,MultiMon,PushSystem feature
    class ConfigDef,ThemeFiles,ConfigMK,CtrlInterface config
    class UtilLayer util
    class ThemeSystem theme

    %% Click events
    click WMCore "https://github.com/instantOS/instantWM/blob/main/instantwm.c"
    click DrawSystem "https://github.com/instantOS/instantWM/blob/main/drw.c"
    click LayoutEngine "https://github.com/instantOS/instantWM/blob/main/layouts.c"
    click UtilLayer "https://github.com/instantOS/instantWM/blob/main/util.c"
    click ThemeSystem "https://github.com/instantOS/instantWM/tree/main//themes"
    click ConfigDef "https://github.com/instantOS/instantWM/blob/main/config.def.h"
    click ConfigMK "https://github.com/instantOS/instantWM/blob/main/config.mk"
    click CtrlInterface "https://github.com/instantOS/instantWM/blob/main/instantwmctrl.sh"
    click PushSystem "https://github.com/instantOS/instantWM/blob/main/push.c"
    click ThemeFiles "https://github.com/instantOS/instantWM/tree/main//themes"
```
