# dreammaomao/mangowc architecture

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

- Interactive diagram: https://gitdiagram.com/dreammaomao/mangowc
- Repository: https://github.com/dreammaomao/mangowc

## Overview

##### Project type and purpose
- Mango is a Wayland compositor (window manager) written in C, built on top of the wlroots library.
- Its purpose is to take client windows (Wayland and XWayland), manage their lifecycle, layout, animations, and effects, and render them to the screen while providing a configurable IPC interface.

##### File structure
- Top-level: build scripts and configs (meson.build, flake.nix, config.conf), assets, licenses, CI workflows.
- src/: core code organized by feature:
- animation/ – window and tag animations
- client/ – client (window) abstraction
- config/ – parsing and presets
- common/ – utilities
- data/ – static keymaps
- dispatch/ – binding declarations and handling input -> actions
- ext-protocol/ – custom Wayland protocol extensions (IPC, workspace, layer, text-input)
- fetch/ – retrieving monitor and input info
- layout/ – window placement algorithms (tile, monocle, grid, etc.)
- mango.c – main entry point, global initialization
- mmsg/: small message-passing library, used for internal and external IPC.
- protocols/: XML descriptions of Wayland extensions.

##### Key insights from the README
- Mango provides window management, animations, tags (workspaces), input method support, IPC, and effects via scenefx.
- Dependencies: wlroots, libinput, libxkbcommon, pixman, scenefx, seatd, etc.
- External configuration and IPC hooks.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Clients & Tools
    subgraph "External Clients & Tools"
        WCli["Wayland Clients"]:::external
        XCli["XWayland Clients"]:::external
        Tools["External Tools\n(app launcher, status bar)"]:::external
    end

    %% Mango Compositor Core
    subgraph "Mango Compositor"
        subgraph "Mango Core"
            MC["Mango Core"]:::core
            Input["Input Subsystem"]:::core
            Dispatch["Dispatch & Binding Engine"]:::core
            Config["Configuration Loader"]:::core
            Layout["Layout Manager"]:::core
            Animation["Animation Engine"]:::core
            ClientAb["Client Abstraction"]:::core
            Common["Common Utilities"]:::core
            Data["Static Keymaps Data"]:::core
            EP["Protocol Extensions"]:::ext
            IPC["IPC Interface"]:::ext
        end

        subgraph "Rendering Subsystem"
            Render["Scenefx & wlroots Renderer"]:::dep
        end
    end

    %% Dependencies
    WC["Wayland Core\n(wlroots)"]:::dep
    ProtocolDefs["Protocol XML Definitions"]:::dep
    GPU["GPU"]:::dep
    Display["Display"]:::dep

    %% Connections
    WCli --> WC
    XCli --> WC
    WC --> Input
    WC --> ClientAb
    Input --> Dispatch
    Dispatch --> Layout
    Dispatch --> Animation
    Config --> Dispatch
    Config --> Layout
    Config --> Animation
    Layout --> Render
    Animation --> Render
    Render --> GPU
    GPU --> Display
    Dispatch -->|"IPC Calls"| IPC
    IPC --> Tools
    EP --> MC
    MC --> Input
    MC --> Dispatch
    MC --> Config
    MC --> Layout
    MC --> Animation
    MC --> ClientAb
    MC --> Common
    MC --> Data
    MC --> EP
    MC --> IPC

    %% Click Events
    click MC "https://github.com/dreammaomao/mangowc/blob/main/src/mango.c"
    click Input "https://github.com/dreammaomao/mangowc/tree/main/src/fetch/"
    click Dispatch "https://github.com/dreammaomao/mangowc/tree/main/src/dispatch/"
    click Config "https://github.com/dreammaomao/mangowc/tree/main/src/config/"
    click Layout "https://github.com/dreammaomao/mangowc/tree/main/src/layout/"
    click Animation "https://github.com/dreammaomao/mangowc/tree/main/src/animation/"
    click ClientAb "https://github.com/dreammaomao/mangowc/tree/main/src/client/"
    click Common "https://github.com/dreammaomao/mangowc/tree/main/src/common/"
    click Data "https://github.com/dreammaomao/mangowc/tree/main/src/data/"
    click EP "https://github.com/dreammaomao/mangowc/tree/main/src/ext-protocol/"
    click IPC "https://github.com/dreammaomao/mangowc/tree/main/mmsg/"
    click ProtocolDefs "https://github.com/dreammaomao/mangowc/tree/main/protocols/"

    %% Styles
    classDef core fill:#D0E8FF,stroke:#3182BD,color:#0C3C6E
    classDef ext fill:#FFE4B5,stroke:#DD914A,color:#7B4F00
    classDef dep fill:#E2F0D9,stroke:#2E7D32,color:#1A3E20
    classDef external fill:#F2F2F2,stroke:#888888,color:#444444;border-dasharray: 2 2
```
