# y9felix/bar architecture

> Architecture diagram of the GitHub repository y9felix/bar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/y9felix/bar
- Repository: https://github.com/y9felix/bar

## Overview

bar is a compact Wayland status-bar application. Its runtime configures a layer-shell surface, gathers system and PulseAudio status, and renders indicators, text, and a clock; autohide and corner placement shape how it is presented. The README documents the product capabilities, while the single C source combines the implementation rather than exposing separate modules. Relationships for unsampled portions are omitted; README-backed capability links are documented rather than inferred from module structure.

Main entry points: [`bar.c`](https://github.com/y9felix/bar/blob/main/bar.c) (Status refresh), [`config.def.h`](https://github.com/y9felix/bar/blob/main/config.def.h) (Bar configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bar runtime"]
  node_config["Bar configuration<br/>[config.def.h]"]
  node_event_loop["Event loop<br/>[bar.c]"]
end

subgraph group_status["Status inputs"]
  node_status_refresh["Status refresh<br/>[bar.c]"]
  node_sysfs[("Power and backlight")]
  node_pulse["PulseAudio"]
  node_clock["Clock"]
end

subgraph group_display["Wayland display"]
  node_renderer["Bar renderer<br/>[bar.c]"]
  node_layer_surface["Layer surface<br/>[bar.c]"]
  node_compositor["Wayland compositor"]
end

node_user(("User"))

node_user -->|"starts"| node_event_loop
node_config -->|"configures"| node_event_loop
node_event_loop -->|"refreshes"| node_status_refresh
node_status_refresh -->|"reads status"| node_sysfs
node_status_refresh -->|"reads volume"| node_pulse
node_status_refresh -->|"updates time"| node_clock
node_status_refresh -->|"supplies status"| node_renderer
node_renderer -->|"commits buffer"| node_layer_surface
node_layer_surface -->|"uses protocol"| node_compositor

click node_config "https://github.com/y9felix/bar/blob/main/config.def.h"
click node_event_loop "https://github.com/y9felix/bar/blob/main/bar.c"
click node_status_refresh "https://github.com/y9felix/bar/blob/main/bar.c"
click node_renderer "https://github.com/y9felix/bar/blob/main/bar.c"
click node_layer_surface "https://github.com/y9felix/bar/blob/main/bar.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_event_loop,node_user toneBlue
class node_status_refresh,node_sysfs,node_pulse,node_clock toneAmber
class node_renderer,node_layer_surface,node_compositor toneMint
```

## Components

### Bar runtime

- [Bar configuration](https://github.com/y9felix/bar/blob/main/config.def.h): `config.def.h`
- [Event loop](https://github.com/y9felix/bar/blob/main/bar.c): `bar.c`

### Status inputs

- [Status refresh](https://github.com/y9felix/bar/blob/main/bar.c): `bar.c`
- **Power and backlight**
- **PulseAudio**
- **Clock**

### Wayland display

- [Bar renderer](https://github.com/y9felix/bar/blob/main/bar.c): `bar.c`
- [Layer surface](https://github.com/y9felix/bar/blob/main/bar.c): `bar.c`
- **Wayland compositor**

### Other components

- **User**

## Connections

- User → Event loop: starts (evidence: `README.md`)
- Bar configuration → Event loop: configures (evidence: `README.md`)
- Event loop → Status refresh: refreshes (evidence: `bar.c`)
- Status refresh → Power and backlight: reads status (evidence: `README.md`)
- Status refresh → PulseAudio: reads volume (evidence: `README.md`)
- Status refresh → Clock: updates time (evidence: `bar.c`)
- Status refresh → Bar renderer: supplies status (evidence: `bar.c`)
- Bar renderer → Layer surface: commits buffer (evidence: `bar.c`)
- Layer surface → Wayland compositor: uses protocol (evidence: `README.md`)
