# eythaann/seelen-ui architecture

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

- Interactive diagram: https://gitdiagram.com/eythaann/seelen-ui
- Repository: https://github.com/eythaann/seelen-ui

## Overview

##### Project Type and Purpose
- This is a full-stack desktop application built with Tauri (Rust + WebView).
- Purpose: Provide a fully customizable Windows desktop environment—taskbar (toolbar), app launcher, tiling window manager, media controller, settings UI, widgets, virtual desktops, etc.

##### File-Structure Analysis
- Top-level:
– src/apps/… → Multiple independent React/TypeScript “mini-apps” (toolbar, seelen_rofi launcher, task-switcher, wallpaper, window manager, settings, etc.)
– src/background/… → Rust “background” process modules interfacing with Windows APIs (monitor, input, network, trays, virtual desktops, etc.)
– src/service/… → Rust “service” process (TCP CLI, scheduler, Windows service entry, shutdown hooks)
– scripts/, templates/ → Build, bundle, installer, MSIX packaging
– tauri.conf.json, Cargo.toml, package.json → Configuration for Rust/Cargo, Node/npm, Tauri

##### Key Insights from README
- Architecture is two-process: a GUI/WebView front end for each UI module, plus two Rust backends (background & service) that expose OS functionality via Tauri commands.
- Uses a modular pattern: each feature has application/domain/infrastructure layers under both TS and Rust.

##### Diagramming the Architecture
a. Main Components:
1. Frontend WebViews (each mini-app in src/apps)
2. Tauri Core / Runtime
3. Rust Background Process (OS integration modules)
4. Rust Service Process (Windows service, CLI, task scheduler)
5. Shared Data & State (state persistence in JSON, settings, profiles)
7. External Dependencies: Windows OS & WinAPI, WebView2, AutoHotkey, PowerShell scripts

b. Relationships & Data Flow:
- WebView UIs communicate with the Background Process via Tauri IPC/commands (e.g., “getMonitors”, “launchApp”, “tileWindow”).
- Background Process calls Windows API (via direct FFI, winapi crates) or invokes AHK/Powershell helpers.
- Service Process runs as a Windows service, scheduling tasks or providing a CLI over TCP, also exposes commands to Background if needed.
- Shared modules (TS and Rust) encapsulate domain logic and data-serialization.
- Static assets loaded by UIs or passed to Background (e.g., theme files).

c. Architectural Patterns & Principles:
- Modular layering: application → domain → infrastructure per feature.
- Clear separation: UI (React/TS) vs. OS logic (Rust).
- Single-source state bridging via shared store modules in TS and Rust.
- Plug-in capability via static/plugins & capabilities JSON for Tauri security.

d. Notable Technologies & Libraries:
– Tauri (tauri.conf.json, build scripts)
– Rust crates: tauri, winapi, serde, tokio
– React + TypeScript + Jest + ESLint
– AutoHotkey mocks, PowerShell scripts for installer & network profiles
– Packaging: MSIX, NSIS, Squirrel (templates/)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        Toolbar["Toolbar UI (React)"]:::frontend
        Launcher["App Launcher UI (React)"]:::frontend
        WindowMgrUI["Window Manager UI (React)"]:::frontend
        TaskbarUI["Taskbar & App Modules (React)"]:::frontend
        SettingsUI["Settings UI (React)"]:::frontend
        TaskSwitcher["Task Switcher UI (React)"]:::frontend
        WallpaperUI["Wallpaper Manager UI (React)"]:::frontend
        WidgetLoader["Widget Loader UI (React)"]:::frontend
        SharedTS["Shared TS Modules (state, components)"]:::storage
    end

    %% Core
    TauriCore["Tauri Core / Runtime"]:::core
    TauriConfig["tauri.conf.json"]:::core
    Capabilities["Tauri Security Capabilities"]:::core

    %% Background Process
    subgraph "Background Process (Rust)"
        direction TB
        Background["Background Process"]:::backend
        Monitors["Monitors Module"]:::backend
        Network["Network Module"]:::backend
        Media["Media Module"]:::backend
        Tray["Tray Module"]:::backend
        VirtDesktop["Virtual Desktops Module"]:::backend
        StatePersist["State Persistence Layer"]:::storage
    end

    %% Service Process
    subgraph "Service Process (Rust)"
        direction TB
        Service["Service Process"]:::backend
    end

    %% Assets and Build
    StaticAssets["Static Assets"]:::storage
    BuildScripts["Build & Packaging Scripts"]:::build

    %% External OS
    OS["Windows OS / WinAPI / WebView2 / AHK / PowerShell"]:::external

    %% Connections: Frontend to Core
    Toolbar -->|IPC Commands| TauriCore
    Launcher -->|IPC Commands| TauriCore
    WindowMgrUI -->|IPC Commands| TauriCore
    TaskbarUI -->|IPC Commands| TauriCore
    SettingsUI -->|IPC Commands| TauriCore
    TaskSwitcher -->|IPC Commands| TauriCore
    WallpaperUI -->|IPC Commands| TauriCore
    WidgetLoader -->|IPC Commands| TauriCore
    SharedTS -->|used by| Toolbar
    SharedTS -->|used by| Launcher
    SharedTS -->|used by| WindowMgrUI

    %% Core to Background
    TauriCore -->|Tauri IPC| Background
    TauriCore -->|Tauri IPC| Monitors
    TauriCore -->|Tauri IPC| Network
    TauriCore -->|Tauri IPC| Media
    TauriCore -->|Tauri IPC| Tray
    TauriCore -->|Tauri IPC| VirtDesktop
    Background -->|persists to| StatePersist

    %% Background to OS/APIs
    Monitors -->|FFI / WinAPI| OS
    Network -->|FFI / WinAPI| OS
    Media -->|FFI / WinAPI| OS
    Tray -->|FFI / WinAPI| OS
    VirtDesktop -->|FFI / WinAPI| OS
    Background -->|invokes| OS

    %% Service to Background
    Service -->|TCP CLI / Scheduler| Background

    %% Assets and Build connections
    StaticAssets -->|loaded by| Toolbar
    StaticAssets -->|loaded by| Background
    BuildScripts -->|builds via| TauriCore
    TauriConfig -->|configures| TauriCore
    Capabilities -->|defines| TauriCore

    %% Group External
    OS

    %% Click Events
    click Toolbar "https://github.com/eythaann/seelen-ui/tree/master/src/apps/toolbar"
    click Launcher "https://github.com/eythaann/seelen-ui/tree/master/src/apps/seelen_rofi"
    click WindowMgrUI "https://github.com/eythaann/seelen-ui/tree/master/src/apps/seelen_wm_v2"
    click TaskbarUI "https://github.com/eythaann/seelen-ui/tree/master/src/apps/seelenweg"
    click SettingsUI "https://github.com/eythaann/seelen-ui/tree/master/src/apps/settings"
    click TaskSwitcher "https://github.com/eythaann/seelen-ui/tree/master/src/apps/seelen_task_switcher_rename_later"
    click WallpaperUI "https://github.com/eythaann/seelen-ui/tree/master/src/apps/seelen_wall"
    click WidgetLoader "https://github.com/eythaann/seelen-ui/tree/master/src/apps/widget_loader"
    click SharedTS "https://github.com/eythaann/seelen-ui/tree/master/src/apps/shared"
    click Background "https://github.com/eythaann/seelen-ui/tree/master/src/background"
    click StatePersist "https://github.com/eythaann/seelen-ui/tree/master/src/background/state"
    click Service "https://github.com/eythaann/seelen-ui/tree/master/src/service"
    click TauriConfig "https://github.com/eythaann/seelen-ui/blob/master/tauri.conf.json"
    click BuildScripts "https://github.com/eythaann/seelen-ui/tree/master/scripts/"
    click StaticAssets "https://github.com/eythaann/seelen-ui/tree/master/static/"
    click Capabilities "https://github.com/eythaann/seelen-ui/tree/master/capabilities/"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000;
    classDef core fill:#FFA500,stroke:#000;
    classDef backend fill:#90EE90,stroke:#000;
    classDef external fill:#D3D3D3,stroke:#000;
    classDef storage fill:#DDA0DD,stroke:#000;
    classDef build fill:#FFD700,stroke:#000;
```
