# danxliu/eww-widgets architecture

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

- Interactive diagram: https://gitdiagram.com/danxliu/eww-widgets
- Repository: https://github.com/danxliu/eww-widgets

## Overview

##### Project type and purpose
- This is a user-configured EWW (Elkow Window Widgets) “vertical bar” widget for Linux desktops.
- It consists of UI definitions (YUCK files), style sheets (SCSS), shell scripts for dynamic data (weather, notifications, media, etc.), and a launcher script to start the bar.

##### File structure
- Top-level:
– `bar.sh` – launcher for the EWW bar
– `scss/` – style definitions in SCSS, compiled to CSS by EWW at runtime
– `yuck/` – EWW UI templates, describing panels, controls, notifications, power menu, etc.
– `scripts/` – shell/ZSH scripts providing dynamic data (weather from OpenWeather API, workspace manager, powermenu actions, sysinfo, logger for notifications, etc.)
- Patterns:
– UI layer: YUCK templates + SCSS for appearance
– Logic layer: standalone scripts invoked by UI events or EWW polling
– Launcher: `bar.sh` starts an EWW daemon instance pointed at these configs

##### Insights from README
- Describes required fonts, OpenWeather API key, Dunst integration for notifications
- Instructs where to install (`$HOME/.config/eww/vertical-bar`) and how to hook into Dunst
- No external service beyond OpenWeather and the local notification daemon

##### Detail without over-partitioning
- 3 layers (UI, style, logic) distinctly.
- Associations between YUCK widgets and corresponding SCSS rules.
- Which scripts are polled vs. event-driven.
- Notes on required fonts & permissions (chmod +x).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Launcher and Core
    barsh["bar.sh (Launcher)"]:::launcher
    eww["EWW Daemon"]:::eww

    barsh -->|"starts"| eww
    eww -->|"loads YUCK templates"| UI
    eww -->|"loads compiled CSS"| Styles

    %% Assets
    Assets["assets/ (Icons)"]:::assets
    Assets -->|"referenced by"| UI
    Assets -->|"referenced by"| Styles

    %% UI Layer
    subgraph UI["UI (YUCK Templates)"]
        BarYUCK["bar.yuck"]:::yuck
        ControlYUCK["control-panel.yuck"]:::yuck
        NotificationYUCK["notification.yuck"]:::yuck
        PanelYUCK["panel.yuck"]:::yuck
        PowermenuYUCK["powermenu.yuck"]:::yuck
        SettingYUCK["setting-panel.yuck"]:::yuck
        VariablesYUCK["variables.yuck"]:::yuck
        WindowsYUCK["windows.yuck"]:::yuck
    end

    %% Styles Layer
    subgraph Styles["Styles (SCSS)"]
        SCSSMain["eww.scss"]:::scss
        BarSCSS["bar.scss"]:::scss
        ControlSCSS["control-panel.scss"]:::scss
        GlobalSCSS["global.scss"]:::scss
        NotificationSCSS["notification.scss"]:::scss
        PanelSCSS["panel.scss"]:::scss
        PowermenuSCSS["powermenu.scss"]:::scss
        SettingSCSS["setting-panel.scss"]:::scss
    end

    %% Logic Layer - Scripts
    subgraph Scripts["Scripts (Logic Layer)"]
        GetWeather["getweather"]:::scripts
        LauncherSC["launcher"]:::scripts
        Logger["logger.zsh"]:::scripts
        Media["media"]:::scripts
        Popup["popup"]:::scripts
        PowermenuSC["powermenu"]:::scripts
        Sysinfo["sysinfo"]:::scripts
        Welcome["welcome"]:::scripts
        Workspace["workspace"]:::scripts
    end

    %% External Services
    subgraph External["External Services"]
        OpenWeather["OpenWeather API"]:::external
        Dunst["Dunst"]:::external
        Rofi["Rofi"]:::external
    end

    %% UI to Scripts interactions
    BarYUCK -->|"poll"| GetWeather
    NotificationYUCK -->|"notification hook"| Logger
    ControlYUCK -->|"click event"| LauncherSC
    PanelYUCK -->|"click/poll"| Media
    PowermenuYUCK -->|"click event"| PowermenuSC
    SettingYUCK -->|"click event"| Popup
    WindowsYUCK -->|"poll"| Workspace

    %% Scripts to External
    GetWeather -->|"HTTP request"| OpenWeather
    Logger -->|"listens to"| Dunst
    LauncherSC -->|"invokes"| Rofi

    %% Styles compilation
    SCSSMain -->|"imports"| GlobalSCSS
    SCSSMain -->|"imports"| BarSCSS
    SCSSMain -->|"imports"| ControlSCSS
    SCSSMain -->|"imports"| NotificationSCSS
    SCSSMain -->|"imports"| PanelSCSS
    SCSSMain -->|"imports"| PowermenuSCSS
    SCSSMain -->|"imports"| SettingSCSS

    %% Click Events
    click barsh "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/bar.sh"
    click Assets "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/assets/"
    click SCSSMain "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/eww.scss"
    click BarSCSS "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scss/bar.scss"
    click ControlSCSS "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scss/control-panel.scss"
    click GlobalSCSS "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scss/global.scss"
    click NotificationSCSS "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scss/notification.scss"
    click PanelSCSS "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scss/panel.scss"
    click PowermenuSCSS "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scss/powermenu.scss"
    click SettingSCSS "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scss/setting-panel.scss"
    click BarYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/bar.yuck"
    click ControlYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/control-panel.yuck"
    click NotificationYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/notification.yuck"
    click PanelYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/panel.yuck"
    click PowermenuYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/powermenu.yuck"
    click SettingYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/setting-panel.yuck"
    click VariablesYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/variables.yuck"
    click WindowsYUCK "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/yuck/windows.yuck"
    click GetWeather "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/getweather"
    click LauncherSC "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/launcher"
    click Logger "https://github.com/danxliu/eww-widgets/blob/main/vertical-bar/scripts/logger.zsh"
    click Media "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/media"
    click Popup "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/popup"
    click PowermenuSC "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/powermenu"
    click Sysinfo "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/sysinfo"
    click Welcome "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/welcome"
    click Workspace "https://github.com/danxliu/eww-widgets/tree/main/vertical-bar/scripts/workspace"

    %% Styles definitions
    classDef launcher fill:#1E90FF,stroke:#000,color:#fff
    classDef eww fill:#4169E1,stroke:#000,color:#fff
    classDef yuck fill:#ADD8E6,stroke:#000
    classDef scss fill:#87CEEB,stroke:#000
    classDef scripts fill:#98FB98,stroke:#000
    classDef assets fill:#FFFFE0,stroke:#000
    classDef external fill:#D3D3D3,stroke:#000,stroke-dasharray: 5 5
```
