# frostymur/aerofi architecture

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

- Interactive diagram: https://gitdiagram.com/frostymur/aerofi
- Repository: https://github.com/frostymur/aerofi

## Overview

Aerofi is a native macOS launcher and script engine. The main workflow runs from startup through launcher state: configured sources become searchable targets, queries rank them, and selection dispatches an action or script; interactive Rofi scripts exchange events and updated rows with the launcher. Separate capabilities cover themes and declarative widgets, Markdown output, plugins, global hotkeys, background refresh, and native window handling. Edges use README statements or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/ui/launcher/state.rs`](https://github.com/frostymur/aerofi/blob/main/src/ui/launcher/state.rs) (Launcher controller), [`src/main.rs`](https://github.com/frostymur/aerofi/blob/main/src/main.rs) (Application startup), [`src/ui/launcher/render.rs`](https://github.com/frostymur/aerofi/blob/main/src/ui/launcher/render.rs) (Launcher rendering), [`src/core/scanner.rs`](https://github.com/frostymur/aerofi/blob/main/src/core/scanner.rs) (Source scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launcher workflow"]
  node_startup["Application startup<br/>[main.rs]"]
  node_config["Configuration<br/>[config.rs]"]
  node_scanner["Source scanner<br/>[scanner.rs]"]
  node_targets["Launcher targets<br/>[item.rs]"]
  node_search["Matching and ranking<br/>[search.rs]"]
  node_history[("Frecency history<br/>[history.rs]")]
  node_launcher["Launcher controller<br/>[state.rs]"]
end

subgraph group_runtime["Scripts and extensions"]
  node_executor["Script execution<br/>[executor.rs]"]
  node_rofi["Rofi IPC protocol<br/>[rofi_protocol.rs]"]
  node_session["Interactive script sessions<br/>[rofi_session.rs]"]
  node_plugins["Native plugins<br/>[plugin_manager.rs]"]
  node_plugin_api["Plugin ABI<br/>[lib.rs]"]
  node_scheduler["Inline refresh scheduler<br/>[scheduler.rs]"]
  node_watcher["Filesystem watcher<br/>[fs_watcher.rs]"]
end

subgraph group_presentation["UI and themes"]
  node_render["Launcher rendering<br/>[render.rs]"]
  node_window["Window management<br/>[window.rs]"]
  node_theme["Theme loader<br/>[theme.rs]"]
  node_widgets["Declarative widgets<br/>[widget.rs]"]
  node_markdown["Markdown rendering model<br/>[markdown.rs]"]
end

subgraph group_platform["macOS services"]
  node_appkit["AppKit integration<br/>[appkit.rs]"]
  node_carbon["Global hotkeys<br/>[carbon.rs]"]
end

node_user(("macOS user"))
node_external_script(("User script"))
node_macos["macOS"]

node_user -->|"launches"| node_startup
node_startup -->|"loads"| node_config
node_startup -->|"starts"| node_scanner
node_scanner -->|"reads"| node_config
node_scanner -->|"creates"| node_targets
node_startup -->|"starts"| node_scheduler
node_startup -->|"starts"| node_watcher
node_user -->|"queries"| node_launcher
node_launcher -->|"filters"| node_search
node_search -->|"ranks"| node_targets
node_search -->|"reads"| node_history
node_launcher -.->|"records"| node_history
node_launcher -->|"dispatches"| node_executor
node_launcher -->|"renders"| node_render
node_render -->|"uses"| node_theme
node_render -->|"renders"| node_markdown
node_render -->|"renders"| node_widgets
node_launcher -->|"queries"| node_plugins
node_plugins -->|"loads ABI"| node_plugin_api
node_launcher -->|"manages"| node_session
node_session -->|"exchanges events"| node_rofi
node_session -->|"starts scripts"| node_executor
node_external_script -->|"streams IPC"| node_rofi
node_scheduler -->|"runs scripts"| node_executor
node_watcher -->|"rescans"| node_scanner
node_window -->|"controls window"| node_appkit
node_carbon -->|"binds targets"| node_targets
node_carbon -.->|"triggers launcher"| node_window
node_appkit -->|"calls APIs"| node_macos
node_user -->|"uses hotkeys"| node_carbon

click node_startup "https://github.com/frostymur/aerofi/blob/main/src/main.rs"
click node_config "https://github.com/frostymur/aerofi/blob/main/src/core/config.rs"
click node_scanner "https://github.com/frostymur/aerofi/blob/main/src/core/scanner.rs"
click node_targets "https://github.com/frostymur/aerofi/blob/main/src/core/item.rs"
click node_search "https://github.com/frostymur/aerofi/blob/main/src/core/search.rs"
click node_history "https://github.com/frostymur/aerofi/blob/main/src/core/history.rs"
click node_launcher "https://github.com/frostymur/aerofi/blob/main/src/ui/launcher/state.rs"
click node_render "https://github.com/frostymur/aerofi/blob/main/src/ui/launcher/render.rs"
click node_window "https://github.com/frostymur/aerofi/blob/main/src/ui/window.rs"
click node_theme "https://github.com/frostymur/aerofi/blob/main/src/core/theme.rs"
click node_widgets "https://github.com/frostymur/aerofi/blob/main/src/core/widget.rs"
click node_markdown "https://github.com/frostymur/aerofi/blob/main/src/core/markdown.rs"
click node_executor "https://github.com/frostymur/aerofi/blob/main/src/core/executor.rs"
click node_rofi "https://github.com/frostymur/aerofi/blob/main/src/core/rofi_protocol.rs"
click node_session "https://github.com/frostymur/aerofi/blob/main/src/core/rofi_session.rs"
click node_plugins "https://github.com/frostymur/aerofi/blob/main/src/core/plugin_manager.rs"
click node_plugin_api "https://github.com/frostymur/aerofi/blob/main/aerofi-plugin-api/src/lib.rs"
click node_scheduler "https://github.com/frostymur/aerofi/blob/main/src/core/scheduler.rs"
click node_watcher "https://github.com/frostymur/aerofi/blob/main/src/core/fs_watcher.rs"
click node_appkit "https://github.com/frostymur/aerofi/blob/main/src/sys/appkit.rs"
click node_carbon "https://github.com/frostymur/aerofi/blob/main/src/sys/carbon.rs"

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_startup,node_config,node_scanner,node_targets,node_search,node_history,node_launcher,node_user,node_external_script toneBlue
class node_executor,node_rofi,node_session,node_plugins,node_plugin_api,node_scheduler,node_watcher toneAmber
class node_render,node_window,node_theme,node_widgets,node_markdown toneMint
class node_appkit,node_carbon toneRose
class node_macos toneIndigo
```

## Components

### Launcher workflow

- [Application startup](https://github.com/frostymur/aerofi/blob/main/src/main.rs): `src/main.rs`
- [Configuration](https://github.com/frostymur/aerofi/blob/main/src/core/config.rs): `src/core/config.rs`
- [Source scanner](https://github.com/frostymur/aerofi/blob/main/src/core/scanner.rs): `src/core/scanner.rs`
- [Launcher targets](https://github.com/frostymur/aerofi/blob/main/src/core/item.rs): `src/core/item.rs`
- [Matching and ranking](https://github.com/frostymur/aerofi/blob/main/src/core/search.rs): `src/core/search.rs`
- [Frecency history](https://github.com/frostymur/aerofi/blob/main/src/core/history.rs): `src/core/history.rs`
- [Launcher controller](https://github.com/frostymur/aerofi/blob/main/src/ui/launcher/state.rs): `src/ui/launcher/state.rs`

### Scripts and extensions

- [Script execution](https://github.com/frostymur/aerofi/blob/main/src/core/executor.rs): `src/core/executor.rs`
- [Rofi IPC protocol](https://github.com/frostymur/aerofi/blob/main/src/core/rofi_protocol.rs): `src/core/rofi_protocol.rs`
- [Interactive script sessions](https://github.com/frostymur/aerofi/blob/main/src/core/rofi_session.rs): `src/core/rofi_session.rs`
- [Native plugins](https://github.com/frostymur/aerofi/blob/main/src/core/plugin_manager.rs): `src/core/plugin_manager.rs`
- [Plugin ABI](https://github.com/frostymur/aerofi/blob/main/aerofi-plugin-api/src/lib.rs): `aerofi-plugin-api/src/lib.rs`
- [Inline refresh scheduler](https://github.com/frostymur/aerofi/blob/main/src/core/scheduler.rs): `src/core/scheduler.rs`
- [Filesystem watcher](https://github.com/frostymur/aerofi/blob/main/src/core/fs_watcher.rs): `src/core/fs_watcher.rs`

### UI and themes

- [Launcher rendering](https://github.com/frostymur/aerofi/blob/main/src/ui/launcher/render.rs): `src/ui/launcher/render.rs`
- [Window management](https://github.com/frostymur/aerofi/blob/main/src/ui/window.rs): `src/ui/window.rs`
- [Theme loader](https://github.com/frostymur/aerofi/blob/main/src/core/theme.rs): `src/core/theme.rs`
- [Declarative widgets](https://github.com/frostymur/aerofi/blob/main/src/core/widget.rs): `src/core/widget.rs`
- [Markdown rendering model](https://github.com/frostymur/aerofi/blob/main/src/core/markdown.rs): `src/core/markdown.rs`

### macOS services

- [AppKit integration](https://github.com/frostymur/aerofi/blob/main/src/sys/appkit.rs): `src/sys/appkit.rs`
- [Global hotkeys](https://github.com/frostymur/aerofi/blob/main/src/sys/carbon.rs): `src/sys/carbon.rs`

### Other components

- **macOS user**
- **User script**
- **macOS**

## Connections

- macOS user → Application startup: launches
- Application startup → Configuration: loads (evidence: `src/main.rs`)
- Application startup → Source scanner: starts (evidence: `src/main.rs`)
- Source scanner → Configuration: reads (evidence: `src/core/scanner.rs`)
- Source scanner → Launcher targets: creates (evidence: `src/core/scanner.rs`)
- Application startup → Inline refresh scheduler: starts (evidence: `src/main.rs`)
- Application startup → Filesystem watcher: starts (evidence: `src/main.rs`)
- macOS user → Launcher controller: queries
- Launcher controller → Matching and ranking: filters (evidence: `src/ui/launcher/state.rs`)
- Matching and ranking → Launcher targets: ranks (evidence: `src/core/search.rs`)
- Matching and ranking → Frecency history: reads (evidence: `src/core/search.rs`)
- Launcher controller → Frecency history: records (evidence: `src/ui/launcher/state.rs`)
- Launcher controller → Script execution: dispatches (evidence: `src/ui/launcher/state.rs`)
- Launcher controller → Launcher rendering: renders (evidence: `src/ui/launcher/render.rs`)
- Launcher rendering → Theme loader: uses (evidence: `src/ui/launcher/render.rs`)
- Launcher rendering → Markdown rendering model: renders (evidence: `src/ui/launcher/render.rs`)
- Launcher rendering → Declarative widgets: renders
- Launcher controller → Native plugins: queries (evidence: `src/ui/launcher/state.rs`)
- Native plugins → Plugin ABI: loads ABI (evidence: `src/core/plugin_manager.rs`)
- Launcher controller → Interactive script sessions: manages (evidence: `src/ui/launcher/sessions.rs`)
- Interactive script sessions → Rofi IPC protocol: exchanges events (evidence: `src/core/rofi_session.rs`)
- Interactive script sessions → Script execution: starts scripts (evidence: `src/core/rofi_session.rs`)
- User script → Rofi IPC protocol: streams IPC
- Inline refresh scheduler → Script execution: runs scripts (evidence: `src/core/scheduler.rs`)
- Filesystem watcher → Source scanner: rescans (evidence: `src/core/fs_watcher.rs`)
- Window management → AppKit integration: controls window (evidence: `src/ui/window.rs`)
- Global hotkeys → Launcher targets: binds targets (evidence: `src/sys/carbon.rs`)
- Global hotkeys → Window management: triggers launcher
- AppKit integration → macOS: calls APIs
- macOS user → Global hotkeys: uses hotkeys
