# danyspin97/wpaperd architecture

> Architecture diagram of the GitHub repository danyspin97/wpaperd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danyspin97/wpaperd
- Repository: https://github.com/danyspin97/wpaperd

## Overview

The system architecture should be represented as follows:

##### Main Components
a. CLI Component (wpaperctl)
- Command interface for user interaction
- Handles commands like next, previous, pause, resume
- Located in /cli directory

b. Daemon Component (wpaperd)
- Core wallpaper management service
- Handles wallpaper rendering and transitions
- Located in /daemon directory

c. IPC Layer
- Communication between CLI and daemon
- Located in /ipc directory

##### Key Architectural Elements

a. Configuration Management
- Config parser (config.rs)
- Information handling (display_info.rs)
- Wallpaper groups management (wallpaper_groups.rs)

b. Image Processing Pipeline
- Image loading system (image_loader.rs)
- Image selection logic (image_picker.rs)
- File list caching (filelist_cache.rs)

c. Rendering System
- EGL context management (render/egl_context.rs)
- OpenGL ES renderer (render/renderer.rs)
- Shader management (render/shader.rs)
- Transition effects (render/transition.rs)
- Wallpaper rendering (render/wallpaper.rs)

##### Data Flow Representation

- User → CLI → IPC → Daemon
- Daemon → Configuration System
- Daemon → File System (wallpaper files)
- Daemon → Display System (Wayland)

##### Component Relationships

Key interactions:
- Configuration file → Daemon
- Daemon → Wayland compositor
- CLI commands → IPC → Daemon
- Daemon → OpenGL ES rendering
- Daemon → File system (wallpaper loading)

##### Technical Details

- Support for multiple displays
- Transition system with 50+ effects
- File watching for configuration changes
- Wallpaper queue management
- Group management

This architecture represents a modern Linux desktop application with clear separation of concerns between user interface, daemon services, and hardware-accelerated rendering capabilities.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph User["User Interaction Layer"]
        UI[User Interface]
        CLI["CLI (wpaperctl)"]:::cli
    end

    subgraph Core["Core System"]
        IPC["IPC Layer"]:::ipc
        Daemon["Daemon (wpaperd)"]:::daemon
    end

    subgraph Config["Configuration System"]
        CP["Config Parser"]:::config
        DI["Display Info"]:::config
        WG["Wallpaper Groups"]:::config
    end

    subgraph Image["Image Processing"]
        IL["Image Loader"]:::image
        IP["Image Picker"]:::image
        FC["File List Cache"]:::image
    end

    subgraph Render["Rendering System"]
        EGL["EGL Context"]:::render
        RND["Renderer"]:::render
        SHD["Shader Management"]:::render
        TRS["Transition Effects"]:::render
        WPR["Wallpaper Renderer"]:::render
        SHC["Shader Collection"]:::render
    end

    subgraph System["System Integration"]
        WL["Wayland Compositor"]
        FS["File System"]
        SD["Systemd Service"]:::system
    end

    %% Connections
    UI --> CLI
    CLI --> IPC
    IPC --> Daemon

    Daemon --> CP
    Daemon --> DI
    Daemon --> WG
    
    Daemon --> IL
    IL --> IP
    IL --> FC
    
    Daemon --> EGL
    EGL --> RND
    RND --> SHD
    RND --> TRS
    RND --> WPR
    SHD --> SHC
    
    Daemon --> WL
    Daemon --> FS
    
    %% Click Events
    click CLI "https://github.com/danyspin97/wpaperd/blob/main/cli/src/main.rs"
    click Daemon "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/wpaperd.rs"
    click IPC "https://github.com/danyspin97/wpaperd/blob/main/ipc/src/lib.rs"
    click CP "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/config.rs"
    click DI "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/display_info.rs"
    click WG "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/wallpaper_groups.rs"
    click IL "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/image_loader.rs"
    click IP "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/image_picker.rs"
    click FC "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/filelist_cache.rs"
    click EGL "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/render/egl_context.rs"
    click RND "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/render/renderer.rs"
    click SHD "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/render/shader.rs"
    click TRS "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/render/transition.rs"
    click WPR "https://github.com/danyspin97/wpaperd/blob/main/daemon/src/render/wallpaper.rs"
    click SHC "https://github.com/danyspin97/wpaperd/tree/main/daemon/src/render/shaders"
    click SD "https://github.com/danyspin97/wpaperd/blob/main/contrib/wpaperd.service"

    %% Styling
    classDef cli fill:#e6b3cc
    classDef daemon fill:#b3d9ff
    classDef ipc fill:#ffcc99
    classDef config fill:#c2f0c2
    classDef image fill:#ffb366
    classDef render fill:#d9b3ff
    classDef system fill:#bfbfbf

    %% Legend
    subgraph Legend
        L1["CLI Components"]:::cli
        L2["Daemon Components"]:::daemon
        L3["IPC Layer"]:::ipc
        L4["Configuration"]:::config
        L5["Image Processing"]:::image
        L6["Rendering"]:::render
        L7["System Integration"]:::system
    end
```
