# anushragu/edgebar architecture

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

- Interactive diagram: https://gitdiagram.com/anushragu/edgebar
- Repository: https://github.com/anushragu/edgebar

## Overview

EdgeBar is a macOS menu bar utility for adjusting built-in display brightness and system output volume with trackpad-edge slides. The user can also adjust either level with a menu slider or toggle haptic feedback. For gestures, the model listens for global touch data, recognizes a single-finger edge slide after movement and time thresholds, then reads and updates the corresponding system level; it also requests alignment haptics. The README documents these capabilities, but hardware behavior is unvalidated, and the excerpts do not show the dependency’s internal dispatch.

Main entry points: [`Sources/EdgeBar/EdgeBarModel.swift`](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarModel.swift) (EdgeBar Model), [`Sources/EdgeBar/EdgeBarApp.swift`](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarApp.swift) (Controls Menu), [`Sources/EdgeBar/BrightnessController.swift`](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/BrightnessController.swift) (Brightness Controller), [`Sources/EdgeBar/VolumeController.swift`](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/VolumeController.swift) (Volume Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Menu Bar Interface"]
  node_app["Menu Bar App<br/>[EdgeBarApp.swift]"]
  node_menu["Controls Menu<br/>[EdgeBarApp.swift]"]
end

subgraph group_gestures["Touch Gesture"]
  node_model["EdgeBar Model<br/>[EdgeBarModel.swift]"]
end

subgraph group_controls["System Controls"]
  node_brightness["Brightness Controller"]
  node_volume["Volume Controller"]
  node_haptics["Haptic Feedback<br/>[EdgeBarModel.swift]"]
end

node_user(("User"))
node_touchpad(("Trackpad Input"))
node_touchstream["Touch Stream"]
node_displayservices["DisplayServices"]
node_coreaudio["Core Audio"]

node_user -->|"uses"| node_menu
node_app -->|"creates"| node_model
node_app -->|"shows"| node_menu
node_menu -->|"sets levels"| node_model
node_touchpad -->|"provides touches"| node_touchstream
node_model -->|"listens"| node_touchstream
node_model -->|"reads and sets"| node_brightness
node_model -->|"reads and sets"| node_volume
node_brightness -->|"calls"| node_displayservices
node_volume -->|"accesses"| node_coreaudio
node_model -->|"updates"| node_haptics
node_haptics -->|"requests pulses"| node_user

click node_app "https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarApp.swift"
click node_menu "https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarApp.swift"
click node_model "https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarModel.swift"
click node_brightness "https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/BrightnessController.swift"
click node_volume "https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/VolumeController.swift"
click node_haptics "https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarModel.swift"

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_app,node_menu,node_user toneBlue
class node_model toneAmber
class node_brightness,node_volume,node_haptics toneMint
class node_touchpad,node_touchstream,node_displayservices,node_coreaudio toneIndigo
```

## Components

### Menu Bar Interface

- [Menu Bar App](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarApp.swift): `Sources/EdgeBar/EdgeBarApp.swift`
- [Controls Menu](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarApp.swift): `Sources/EdgeBar/EdgeBarApp.swift`

### Touch Gesture

- [EdgeBar Model](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarModel.swift): `Sources/EdgeBar/EdgeBarModel.swift`

### System Controls

- [Brightness Controller](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/BrightnessController.swift): `Sources/EdgeBar/BrightnessController.swift`
- [Volume Controller](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/VolumeController.swift): `Sources/EdgeBar/VolumeController.swift`
- [Haptic Feedback](https://github.com/anushragu/edgebar/blob/main/Sources/EdgeBar/EdgeBarModel.swift): `Sources/EdgeBar/EdgeBarModel.swift`

### Other components

- **User**
- **Trackpad Input**
- **Touch Stream**
- **DisplayServices**
- **Core Audio**

## Connections

- User → Controls Menu: uses (evidence: `README.md`)
- Menu Bar App → EdgeBar Model: creates (evidence: `Sources/EdgeBar/EdgeBarApp.swift`)
- Menu Bar App → Controls Menu: shows (evidence: `Sources/EdgeBar/EdgeBarApp.swift`)
- Controls Menu → EdgeBar Model: sets levels (evidence: `Sources/EdgeBar/EdgeBarApp.swift`)
- Trackpad Input → Touch Stream: provides touches (evidence: `README.md`)
- EdgeBar Model → Touch Stream: listens (evidence: `Sources/EdgeBar/EdgeBarModel.swift`)
- EdgeBar Model → Brightness Controller: reads and sets (evidence: `Sources/EdgeBar/EdgeBarModel.swift`)
- EdgeBar Model → Volume Controller: reads and sets (evidence: `Sources/EdgeBar/EdgeBarModel.swift`)
- Brightness Controller → DisplayServices: calls (evidence: `Sources/EdgeBar/BrightnessController.swift`)
- Volume Controller → Core Audio: accesses (evidence: `Sources/EdgeBar/VolumeController.swift`)
- EdgeBar Model → Haptic Feedback: updates (evidence: `Sources/EdgeBar/EdgeBarModel.swift`)
- Haptic Feedback → User: requests pulses (evidence: `README.md`)
