# adi1090x/rofi architecture

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

- Interactive diagram: https://gitdiagram.com/adi1090x/rofi
- Repository: https://github.com/adi1090x/rofi

## Overview

##### Project type and purpose
- This is an open-source “theme ecosystem” for Rofi (a window switcher / launcher).

##### File structure
- Top-level:
- .github (CI / sponsorship metadata)
- LICENSE, README.md (project metadata)
- setup.sh (installer script)
- files/ (all theme definitions)
- fonts/, previews/ (resources)
- Under files/:
- config.rasi (root config template)
- scripts/ (symlinks to each launcher, applet, powermenu for PATH integration)

##### README for insights
- Confirms usage patterns: clone repo → chmod +x setup.sh → ./setup.sh → Rofi picks up ~/.config/rofi files.

##### Main components & interactions
a. Components
- GitHub Repo (source of truth)
- setup.sh installer
- Local File System (~/…/.config/rofi/)
- Rofi Application (1.7.4)
- Theme Files (.rasi) & Shell Scripts (.sh)
- External Utilities (pkexec, acpi, light, mpd/mpc, maim, amixer, etc.)
- User (keyboard/mouse input, window manager triggers)
b. Relationships / Data Flow
1. Developer clones repo → runs setup.sh
2. setup.sh reads files/, fonts/, previews/ → backs up existing ~/.config/rofi → installs new configs and fonts → updates font cache
3. User invokes one of the shell scripts (via keybinding or polybar module)
5. Rofi renders UI using selected .rasi theme and queries external utilities for dynamic data (battery status, volume, screenshot, systemd power options, etc.)
6. User selection is processed by the script, which calls external commands (e.g. pkexec, alacritty, shutdown)
7. Rofi closes; action is executed on the system
c. Architectural patterns / principles
- Modular file layout: each theme “type” is isolated (type-X folders)
- Script-driven UI: shell scripts manage both theme selection and external command orchestration
- Convention over configuration: fixed folder structure under ~/.config/rofi
d. Key technologies
- Bash scripts (setup.sh, launcher.sh, powermenu.sh, applets/bin/*.sh)
- Rofi theme syntax (.rasi files)
- Fontconfig (installing fonts, updating cache)
- External CLI tools for system queries
- Git / GitHub for distribution and CI

##### Essential architectural elements to capture
- Installer workflow
- Directory structure under ~/.config/rofi
- Script → Theme → Rofi → Action chain
- Integration with external commands and window manager

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Repository & Installer
    subgraph "Repository & Installer"
        Repo["GitHub Repository"]:::blue
        GHmetadata[".github/, LICENSE, README.md"]:::blue
        Installer["setup.sh"]:::green
    end

    %% Local Config
    subgraph "Local Configuration Store (~/.config/rofi)"
        ConfigRasi["config.rasi"]:::blue
        GlobalColors["colors/*.rasi"]:::blue
    end

    %% Resources
    subgraph "Resources"
        Fonts["fonts/"]:::blue
        Previews["previews/"]:::blue
    end

    %% Scripts & Theme Files
    subgraph "Scripts & Theme Files"
        subgraph Launchers
            L1["type-1/launcher.sh"]:::green
            LS1["type-1/style-*.rasi"]:::blue
            LSC1["type-1/shared/colors.rasi"]:::blue
            LSF1["type-1/shared/fonts.rasi"]:::blue

            L2["type-2/launcher.sh"]:::green
            LS2["type-2/style-*.rasi"]:::blue
            LSC2["type-2/shared/colors.rasi"]:::blue
            LSF2["type-2/shared/fonts.rasi"]:::blue

            L3["type-3/launcher.sh"]:::green
            LS3["type-3/style-*.rasi"]:::blue

            L4["type-4/launcher.sh"]:::green
            LS4["type-4/style-*.rasi"]:::blue

            L5["type-5/launcher.sh"]:::green
            LS5["type-5/style-*.rasi"]:::blue

            L6["type-6/launcher.sh"]:::green
            LS6["type-6/style-*.rasi"]:::blue

            L7["type-7/launcher.sh"]:::green
            LS7["type-7/style-*.rasi"]:::blue
        end

        subgraph Applets
            ABin["applets/bin/*.sh"]:::green
            ASharedC["applets/shared/colors.rasi"]:::blue
            ASharedF["applets/shared/fonts.rasi"]:::blue
            ATheme["applets/shared/theme.bash"]:::green
            AS1["type-1/style-*.rasi"]:::blue
        end

        subgraph "Power-menu Plugins"
            P1["type-1/powermenu.sh"]:::green
            PS1["type-1/style-*.rasi"]:::blue
            PSC1["type-1/shared/colors.rasi"]:::blue
            PSF1["type-1/shared/fonts.rasi"]:::blue

            P2["type-2/powermenu.sh"]:::green
            PS2["type-2/style-*.rasi"]:::blue

            P3["type-3/powermenu.sh"]:::green
            PS3["type-3/style-*.rasi"]:::blue

            P4["type-4/powermenu.sh"]:::green
            PS4["type-4/style-*.rasi"]:::blue

            P5["type-5/powermenu.sh"]:::green
            PS5["type-5/style-*.rasi"]:::blue

            P6["type-6/powermenu.sh"]:::green
            PS6["type-6/style-*.rasi"]:::blue
        end
    end

    %% Symlinked Scripts
    subgraph "Symlinked Scripts for PATH"
        Symlinks["scripts/launcher_t1…launcher_t7, powermenu_t1…t6"]:::green
    end

    %% Runtime & Execution
    User["User"]:::gray
    WM["Window Manager / Polybar"]:::gray
    Scripts["Shell Scripts"]:::green
    Rofi["Rofi Application"]:::green
    External["External Utilities"]:::orange
    Screen["Screen (X11/Wayland)"]:::gray

    %% Connections
    Repo -->|"clone/install"| Installer
    Installer -->|"writes configs/fonts"| ConfigRasi
    Installer --> GlobalColors
    Installer --> Fonts
    Installer --> Previews

    User -->|"keyboard/mouse"| WM
    WM -->|"invoke script"| Symlinks
    Symlinks --> Scripts
    Scripts -->|"load .rasi themes"| Rofi
    Rofi -->|"render UI"| Screen
    Scripts -->|"exec actions"| External
    External -->|"data/status"| Rofi

    %% Click Events
    click GHmetadata "https://github.com/adi1090x/rofi/tree/master/.github/"
    click GHmetadata "https://github.com/adi1090x/rofi/tree/master/LICENSE"
    click GHmetadata "https://github.com/adi1090x/rofi/blob/master/README.md"
    click Installer "https://github.com/adi1090x/rofi/blob/master/setup.sh"
    click ConfigRasi "https://github.com/adi1090x/rofi/blob/master/files/config.rasi"
    click GlobalColors "https://github.com/adi1090x/rofi/tree/master/files/colors/"
    click Fonts "https://github.com/adi1090x/rofi/tree/master/fonts/"
    click Previews "https://github.com/adi1090x/rofi/tree/master/previews/"
    click L1 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-1/launcher.sh"
    click LS1 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-1/style-*.rasi"
    click LSC1 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-1/shared/colors.rasi"
    click LSF1 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-1/shared/fonts.rasi"
    click L2 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-2/launcher.sh"
    click LS2 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-2/style-*.rasi"
    click LSC2 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-2/shared/colors.rasi"
    click LSF2 "https://github.com/adi1090x/rofi/blob/master/files/launchers/type-2/shared/fonts.rasi"
    click ABin "https://github.com/adi1090x/rofi/blob/master/files/applets/bin/*.sh"
    click ASharedC "https://github.com/adi1090x/rofi/blob/master/files/applets/shared/colors.rasi"
    click ASharedF "https://github.com/adi1090x/rofi/blob/master/files/applets/shared/fonts.rasi"
    click ATheme "https://github.com/adi1090x/rofi/blob/master/files/applets/shared/theme.bash"
    click P1 "https://github.com/adi1090x/rofi/blob/master/files/powermenu/type-1/powermenu.sh"
    click PS1 "https://github.com/adi1090x/rofi/blob/master/files/powermenu/type-1/style-*.rasi"
    click PSC1 "https://github.com/adi1090x/rofi/blob/master/files/powermenu/type-1/shared/colors.rasi"
    click PSF1 "https://github.com/adi1090x/rofi/blob/master/files/powermenu/type-1/shared/fonts.rasi"
    click Symlinks "https://github.com/adi1090x/rofi/tree/master/files/scripts/"

    %% Styles
    classDef blue fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef green fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef orange fill:#ffe5cc,stroke:#333,stroke-width:1px
    classDef gray fill:#eeeeee,stroke:#333,stroke-width:1px
```
