# kde/latte-dock architecture

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

- Interactive diagram: https://gitdiagram.com/kde/latte-dock
- Repository: https://github.com/kde/latte-dock

## Overview

##### Project’s Main Components
- Core Engine (app folder):
– Contains the central logic (e.g., app/main.cpp, lattecorona.cpp) that drives the dock.
– Manages core functionality such as configurations, DBus communication (see app/dbus) and window management.
- UI & Presentation Layer:
– Composed of multiple submodules including “view”, “settings”, “layout”, “screenpool” and others within the app directory.
– QML components and declarative items are found in folders like “plasmoid”, “shell” and “declarativeimports” that build the interactive, animated UI (notably the parabolic zoom effects).
- Plugins and Extensibility:
– “Indicators”, “containment”, “containmentactions”, and various “package” folders supply extension points to add new behaviors or integrate with other components of the Plasma system.
– These modules follow the KDE plugin architecture (e.g., the “plasmoid/plugin” and “packageplugins” directories).
- Configuration & Templates:
– Components like “app/settings”, “app/templates” and configuration-related files (e.g., .knsrc files, and numerous QML configuration files in shell/package/contents/configuration) support user settings and customization.

##### Relationships and Interactions
- The Core Engine communicates with:
– The UI layer (through QML/Declarative interfaces) to update visuals, render animations, and respond to user interactions.
– Plugin modules (like indicators and containment actions) which supply extra functionalities (e.g., layout management, context menus).
- DBus is used for inter-process communication and event handling (see app/dbus/org.kde.LatteDock.xml).
- Settings and configuration modules feed data to both the core engine and UI components, allowing dynamic behavior based on user preferences.
- The build system (CMake) ties together a variety of modules and external dependencies (Qt, KF5 libraries, Plasma, etc.) that are essential for the dock’s operation.

##### Architectural Patterns & Design Principles
- Modularity: Clearly divided modules for core logic, UI, plugins, and configuration.
- Separation of Concerns: C++ components handling low-level operations and DBus communication are isolated from the high-level QML UI elements.
- Plugin-based Extensibility: Using directories like “plasmoid”, “containment”, “indicators”, the project allows integrating or replacing parts without altering the core.
- Declarative UI Design: Heavy usage of QML and declarative imports encapsulates UI logic in a flexible and modern style.
- Event/Signal-driven interactions typical for Qt applications facilitate communication between components.

## Diagram (Mermaid)

```mermaid
graph TD
    %% External Dependencies
    subgraph "External Dependencies"
        External["External Libraries<BR/>(Qt, KF5, Plasma, Wayland/X11)"]
    end

    %% Core Engine
    subgraph "Core Engine"
        CoreEngine["Core Engine"]
        DBusInterface["DBus Interface"]
    end

    %% UI Layer
    subgraph "UI Layer"
        ViewComponents["View Components"]
        QMLPlasmoid["QML/Plasmoid"]
        DeclarativeUI["Declarative Imports"]
        ShellUI["Shell UI"]
    end

    %% Plugin Modules
    subgraph "Plugin Modules"
        Indicators["Indicators"]
        Containment["Containment"]
        ContainmentActions["ContainmentActions"]
        PackagePlugins["Package Plugins"]
    end

    %% Configuration & Templates
    subgraph "Configuration & Templates"
        Settings["Settings"]
        Templates["Templates"]
    end

    %% Connections from External Dependencies
    External -->|"libraries"| CoreEngine
    External -->|"libraries"| QMLPlasmoid
    External -->|"libraries"| DeclarativeUI
    External -->|"libraries"| ShellUI
    External -->|"libraries"| Indicators
    External -->|"libraries"| Containment
    External -->|"libraries"| ContainmentActions
    External -->|"libraries"| PackagePlugins

    %% Core Engine connections
    CoreEngine -->|"DBus-events"| DBusInterface

    CoreEngine -->|"UI-update"| ViewComponents
    CoreEngine -->|"UI-update"| QMLPlasmoid
    CoreEngine -->|"UI-update"| DeclarativeUI
    CoreEngine -->|"UI-update"| ShellUI

    %% Plugin bidirectional communications
    CoreEngine <-->|"plugin-comm"| Indicators
    CoreEngine <-->|"plugin-comm"| Containment
    CoreEngine <-->|"plugin-comm"| ContainmentActions
    CoreEngine <-->|"plugin-comm"| PackagePlugins

    %% Configuration feeding data
    Settings -->|"config-data"| CoreEngine
    Templates -->|"template-data"| CoreEngine
    Settings -->|"config-update"| ViewComponents
    Templates -->|"layout-template"| ShellUI

    %% Styling
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef ui fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef plugin fill:#98FB98,stroke:#000,stroke-width:2px;
    classDef config fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:2px;

    class CoreEngine,DBusInterface external,core;
    class ViewComponents,QMLPlasmoid,DeclarativeUI,ShellUI ui;
    class Indicators,Containment,ContainmentActions,PackagePlugins plugin;
    class Settings,Templates config;
    class External external;

    %% Click Events
    click CoreEngine "https://github.com/kde/latte-dock/tree/master/app"
    click DBusInterface "https://github.com/kde/latte-dock/blob/master/app/dbus/org.kde.LatteDock.xml"
    click ViewComponents "https://github.com/kde/latte-dock/tree/master/app/view"
    click QMLPlasmoid "https://github.com/kde/latte-dock/tree/master/plasmoid"
    click DeclarativeUI "https://github.com/kde/latte-dock/tree/master/declarativeimports"
    click ShellUI "https://github.com/kde/latte-dock/tree/master/shell"
    click Indicators "https://github.com/kde/latte-dock/tree/master/indicators"
    click Containment "https://github.com/kde/latte-dock/tree/master/containment"
    click ContainmentActions "https://github.com/kde/latte-dock/tree/master/containmentactions"
    click PackagePlugins "https://github.com/kde/latte-dock/tree/master/app/packageplugins"
    click Settings "https://github.com/kde/latte-dock/tree/master/app/settings"
    click Templates "https://github.com/kde/latte-dock/tree/master/app/templates"
```
