# hyde-project/hyde architecture

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

- Interactive diagram: https://gitdiagram.com/hyde-project/hyde
- Repository: https://github.com/hyde-project/hyde

## Overview

##### Project type and purpose
- This is an open‑source, script‑driven “dotfiles” and system‑provisioning tool (HyDE) for Arch‑based Linux distros.
- It automates installation of packages, theming, window manager (Hyprland) configuration, GTK/Qt theming, SDDM/GRUB tweaks, and dotfile deployment.

##### Main components
a. User Environment (target machine running Arch Linux or Arch‐based distro)
b. CLI Installer (Scripts/install.sh, global_fn.sh, install_*.sh)
c. Script Library (.local/lib/hyde – shell functions, Python modules under pyutils)
d. Configuration Store
– Raw configs in Configs/ and Source/assets
– Backups in ~/.config/cfg_backups
e. Package Manager & Repositories
– pacman and AUR (via install_aur.sh)
– Remote GitHub repos: HyDE core, hyde‑themes, hyde‑gallery
f. Desktop Components
– Hyprland (Wayland compositor)
– SDDM (display manager)
– Rofi, Waybar, Wlogout, GTK/Qt theming engines
g. External Services
– GitHub (source), Discord badges, star‑history API

##### Relationships and interactions
- User → invokes install.sh with optional pkg_user list
- install.sh → sources global_fn.sh → parses pkg lists (pkg_core.lst, pkg_extra.lst) → calls pacman/AUR helper
- install.sh → calls restore_cfg.sh to copy configs into ~/.config and ~/.local/share
- Script library (shell + Python) provides helpers: configuration parsing, logging, theme patching
- Theme patcher → clones hyde‑themes → applies theme files to Configs/ and Source/assets → final config in ~/.config
- Desktop components load their configs from ~/.config on login
- Backup scripts save any overwritten configs to ~/.config/cfg_backups

##### Architectural patterns & design principles
- Modular scripts + shared library (separation of concerns)
- Declarative config lists (pkg_*.lst) drive package installation
- File‑system as the “data store” (no central DB)
- External repos for extensibility (themes, gallery)

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% User Environment
  User["User on Arch Linux"]:::runtime

  %% CLI Installer Layer
  subgraph "CLI Installer" 
    direction TB
    CoreInstaller["install.sh"]:::code
    GlobalFns["global_fn.sh"]:::code
    InstallPkg["install_pkg.sh"]:::code
    InstallAUR["install_aur.sh"]:::code
    PkgCore["pkg_core.lst"]:::code
    PkgExtra["pkg_extra.lst"]:::code
    RestoreCFG["restore_cfg.sh"]:::code
    RestoreList["restore_cfg.lst"]:::code
    Themepatcher["themepatcher.sh"]:::code
    ThemeList["themepatcher.lst"]:::code
    Uninstaller["uninstall.sh"]:::code
  end

  %% Script Library
  subgraph "Script Library" 
    direction TB
    ShellLib[".local/lib/hyde/"]:::code
    PyUtils[".local/lib/hyde/pyutils/"]:::code
  end

  %% Configuration Store
  subgraph "Configuration Store"
    direction TB
    RawConfigs["Configs/"]:::code
    Assets["Source/assets/"]:::code
    Arcs["Source/arcs/"]:::code
    Backups["~/.config/cfg_backups"]:::runtime
    Fastfetch[".local/share/fastfetch/presets/hyde/"]:::code
    HydeShare[".local/share/hyde/"]:::code
  end

  %% Package Manager & Repositories
  subgraph "Package Manager & Repos"
    direction TB
    Pacman["pacman"]:::external
    AUR["AUR"]:::external
    GitHub["GitHub Repos"]:::external
    ThemesRepo["hyde-themes"]:::external
    GalleryRepo["hyde-gallery"]:::external
  end

  %% Desktop Components
  subgraph "Desktop Components"
    direction TB
    Hyprland["Hyprland (Wayland)"]:::runtime
    SDDM["SDDM"]:::runtime
    Rofi["Rofi"]:::runtime
    Waybar["Waybar"]:::runtime
    Wlogout["Wlogout"]:::runtime
    GTK3["GTK Theming"]:::runtime
    Qt5["qt5ct/"]:::runtime
    Qt6["qt6ct/"]:::runtime
    Kvantum["Kvantum/"]:::runtime
  end

  %% External Services
  subgraph "External Services"
    direction TB
    Discord["Discord Badges"]:::external
    StarAPI["Star-history API"]:::external
  end

  %% Connections
  User -->|"invokes"| CoreInstaller
  CoreInstaller -->|"sources"| GlobalFns
  CoreInstaller -->|"reads"| PkgCore
  CoreInstaller -->|"reads"| PkgExtra
  CoreInstaller -->|"calls"| InstallPkg
  CoreInstaller -->|"calls"| InstallAUR
  CoreInstaller -->|"calls"| RestoreCFG
  CoreInstaller -->|"uses"| Themepatcher
  CoreInstaller -->|"supports"| Uninstaller

  InstallPkg -->|"installs"| Pacman
  InstallAUR -->|"installs"| AUR

  RestoreCFG -->|"copies configs from"| RawConfigs
  RestoreCFG -->|"copies assets from"| Assets
  RawConfigs -->|"backups overwritten files to"| Backups

  Themepatcher -->|"git clone"| ThemesRepo
  Themepatcher -->|"applies themes to"| RawConfigs
  Themepatcher -->|"uses assets from"| Assets

  GlobalFns -->|"provides helpers to"| CoreInstaller
  ShellLib -->|"sourced by"| CoreInstaller
  PyUtils -->|"used by"| Themepatcher

  GitHub -->|"hosts core and modules"| CoreInstaller
  ThemesRepo -->|"external themes"| Themepatcher
  GalleryRepo -->|"gallery data"| CoreInstaller

  %% Desktop load configs
  Hyprland -->|"loads from ~/.config/hypr/"| RawConfigs
  SDDM -->|"loads themes from"| Arcs
  Rofi -->|"loads from ~/.config/rofi/"| RawConfigs
  Waybar -->|"loads from ~/.config/waybar/"| RawConfigs
  Wlogout -->|"loads from ~/.config/wlogout/"| RawConfigs
  GTK3 -->|"loads from ~/.config/gtk-3.0/"| RawConfigs
  Qt5 -->|"loads from ~/.config/qt5ct/"| RawConfigs
  Qt6 -->|"loads from ~/.config/qt6ct/"| RawConfigs
  Kvantum -->|"loads from ~/.config/Kvantum/"| RawConfigs

  %% External Services
  StarAPI -->|"queried by"| CoreInstaller
  Discord -->|"badges displayed in docs"| CoreInstaller

  %% Click Events
  click CoreInstaller "https://github.com/hyde-project/hyde/blob/master/Scripts/install.sh"
  click GlobalFns "https://github.com/hyde-project/hyde/blob/master/Scripts/global_fn.sh"
  click InstallPkg "https://github.com/hyde-project/hyde/blob/master/Scripts/install_pkg.sh"
  click InstallAUR "https://github.com/hyde-project/hyde/blob/master/Scripts/install_aur.sh"
  click PkgCore "https://github.com/hyde-project/hyde/blob/master/Scripts/pkg_core.lst"
  click PkgExtra "https://github.com/hyde-project/hyde/blob/master/Scripts/pkg_extra.lst"
  click RestoreCFG "https://github.com/hyde-project/hyde/blob/master/Scripts/restore_cfg.sh"
  click RestoreList "https://github.com/hyde-project/hyde/blob/master/Scripts/restore_cfg.lst"
  click Themepatcher "https://github.com/hyde-project/hyde/blob/master/Scripts/themepatcher.sh"
  click ThemeList "https://github.com/hyde-project/hyde/blob/master/Scripts/themepatcher.lst"
  click Uninstaller "https://github.com/hyde-project/hyde/blob/master/Scripts/uninstall.sh"
  click ShellLib "https://github.com/hyde-project/hyde/tree/master/Configs/.local/lib/hyde/"
  click PyUtils "https://github.com/hyde-project/hyde/tree/master/Configs/.local/lib/hyde/pyutils/"
  click RawConfigs "https://github.com/hyde-project/hyde/tree/master/Configs/"
  click Assets "https://github.com/hyde-project/hyde/tree/master/Source/assets/"
  click Arcs "https://github.com/hyde-project/hyde/tree/master/Source/arcs/"
  click Fastfetch "https://github.com/hyde-project/hyde/tree/master/Configs/.local/share/fastfetch/presets/hyde/"
  click HydeShare "https://github.com/hyde-project/hyde/tree/master/Configs/.local/share/hyde/"

  %% Styling
  classDef code fill:#D0E6FF,stroke:#333,stroke-width:1px;
  classDef runtime fill:#D5F5E3,stroke:#333,stroke-width:1px;
  classDef external fill:#FFE5B4,stroke:#333,stroke-width:1px;
  classDef db fill:#FFF2CC,stroke:#333,stroke-width:1px;
```
