# tim4c/btopdesktop architecture

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

- Interactive diagram: https://gitdiagram.com/tim4c/btopdesktop
- Repository: https://github.com/tim4c/btopdesktop

## Overview

Btop Desktop hosts the bundled btop monitor in a native macOS desktop panel. The main workflow runs from the menu-bar app through panel and terminal setup to btop output rendered by the terminal view; Settings changes presentation, themes, or desktop-icon visibility. The graph preserves the README’s documented interaction, appearance, theme, and Mission Control capabilities. Some runtime and UI links are based on the SOURCE INDEX rather than complete excerpts, so unsampled connections are omitted.

Main entry points: [`Sources/BtopDesktop/App/AppDelegate.swift`](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/AppDelegate.swift) (App delegate), [`Sources/BtopDesktop/App/DesktopWindowController.swift`](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/DesktopWindowController.swift) (Panel controller), [`Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift`](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift) (Terminal runtime), [`Sources/BtopDesktop/UI/TerminalViewController.swift`](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/TerminalViewController.swift) (Terminal controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and panel"]
  node_delegate["App delegate<br/>[AppDelegate.swift]"]
  node_window["Panel controller"]
  node_panel["Desktop panel<br/>[DesktopPanel.swift]"]
  node_preferences[("Preferences")]
  node_paneldefaults["Panel defaults"]
  node_appearance["Appearance state"]
end

subgraph group_terminal["Terminal runtime"]
  node_runtime["Terminal runtime"]
  node_process["Process bridge"]
  node_pty["PTY connection"]
  node_terminalview["Terminal controller"]
  node_nativeview["Native terminal view"]
  node_escape["Escape filtering"]
end

subgraph group_settings["Settings and themes"]
  node_settingscontroller["Settings controller"]
  node_settingsview["Settings interface<br/>[SettingsView.swift]"]
  node_config[("Btop configuration")]
  node_themestore[("Theme store")]
  node_themecatalog["Theme catalog"]
end

subgraph group_desktop["Desktop integration"]
  node_icons["Icon visibility"]
  node_overview["Overview monitor"]
  node_overviewstate["Overview state"]
end

node_user(("Mac user"))

node_user -->|"opens app"| node_delegate
node_delegate -->|"creates panel"| node_window
node_delegate -->|"starts runtime"| node_runtime
node_delegate -->|"loads settings"| node_preferences
node_window -->|"configures terminal"| node_terminalview
node_window -->|"configures panel"| node_panel
node_window -->|"updates appearance"| node_appearance
node_preferences -->|"uses defaults"| node_paneldefaults
node_terminalview -->|"sends input and resize"| node_runtime
node_terminalview -->|"renders terminal"| node_nativeview
node_panel -->|"filters Escape"| node_escape
node_runtime -->|"manages process"| node_process
node_runtime -->|"prepares configuration"| node_config
node_runtime -->|"validates theme"| node_themestore
node_settingscontroller -->|"handles events"| node_settingsview
node_settingsview -->|"edits presentation"| node_paneldefaults
node_themestore -->|"uses configuration"| node_config
node_themecatalog -->|"lists themes"| node_themestore
node_delegate -->|"controls visibility"| node_icons
node_window -->|"tracks overview"| node_overview
node_overview -->|"updates state"| node_overviewstate

click node_delegate "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/AppDelegate.swift"
click node_window "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/DesktopWindowController.swift"
click node_panel "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/DesktopPanel.swift"
click node_preferences "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/AppPreferences.swift"
click node_paneldefaults "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/PanelPreferences.swift"
click node_appearance "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/DesktopAppearanceState.swift"
click node_runtime "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift"
click node_process "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/NativeProcessBridge.swift"
click node_pty "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/NativePTYConnection.swift"
click node_terminalview "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/TerminalViewController.swift"
click node_nativeview "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/NativeTerminalView.swift"
click node_escape "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/TerminalEscapeFilter.swift"
click node_settingscontroller "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/SettingsWindowController.swift"
click node_settingsview "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/SettingsView.swift"
click node_config "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/BtopConfigurationStore.swift"
click node_themestore "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/BtopThemeStore.swift"
click node_themecatalog "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/BtopThemeCatalog.swift"
click node_icons "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/DesktopIconVisibilityController.swift"
click node_overview "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/DesktopOverviewMonitor.swift"
click node_overviewstate "https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/DesktopOverviewState.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_delegate,node_window,node_panel,node_preferences,node_paneldefaults,node_appearance,node_user toneBlue
class node_runtime,node_process,node_pty,node_terminalview,node_nativeview,node_escape toneAmber
class node_settingscontroller,node_settingsview,node_config,node_themestore,node_themecatalog toneMint
class node_icons,node_overview,node_overviewstate toneRose
```

## Components

### App and panel

- [App delegate](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/AppDelegate.swift): `Sources/BtopDesktop/App/AppDelegate.swift`
- [Panel controller](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/DesktopWindowController.swift): `Sources/BtopDesktop/App/DesktopWindowController.swift`
- [Desktop panel](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/DesktopPanel.swift): `Sources/BtopDesktop/App/DesktopPanel.swift`
- [Preferences](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/AppPreferences.swift): `Sources/BtopDesktop/App/AppPreferences.swift`
- [Panel defaults](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/PanelPreferences.swift): `Sources/BtopDesktop/App/PanelPreferences.swift`
- [Appearance state](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/DesktopAppearanceState.swift): `Sources/BtopDesktop/App/DesktopAppearanceState.swift`

### Terminal runtime

- [Terminal runtime](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift): `Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift`
- [Process bridge](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/NativeProcessBridge.swift): `Sources/BtopDesktop/Infrastructure/NativeProcessBridge.swift`
- [PTY connection](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/NativePTYConnection.swift): `Sources/BtopDesktop/Infrastructure/NativePTYConnection.swift`
- [Terminal controller](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/TerminalViewController.swift): `Sources/BtopDesktop/UI/TerminalViewController.swift`
- [Native terminal view](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/NativeTerminalView.swift): `Sources/BtopDesktop/UI/NativeTerminalView.swift`
- [Escape filtering](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/App/TerminalEscapeFilter.swift): `Sources/BtopDesktop/App/TerminalEscapeFilter.swift`

### Settings and themes

- [Settings controller](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/SettingsWindowController.swift): `Sources/BtopDesktop/UI/SettingsWindowController.swift`
- [Settings interface](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/UI/SettingsView.swift): `Sources/BtopDesktop/UI/SettingsView.swift`
- [Btop configuration](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/BtopConfigurationStore.swift): `Sources/BtopDesktop/Infrastructure/BtopConfigurationStore.swift`
- [Theme store](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/BtopThemeStore.swift): `Sources/BtopDesktop/Infrastructure/BtopThemeStore.swift`
- [Theme catalog](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/BtopThemeCatalog.swift): `Sources/BtopDesktop/Infrastructure/BtopThemeCatalog.swift`

### Desktop integration

- [Icon visibility](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/DesktopIconVisibilityController.swift): `Sources/BtopDesktop/Infrastructure/DesktopIconVisibilityController.swift`
- [Overview monitor](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/DesktopOverviewMonitor.swift): `Sources/BtopDesktop/Infrastructure/DesktopOverviewMonitor.swift`
- [Overview state](https://github.com/tim4c/btopdesktop/blob/main/Sources/BtopDesktop/Infrastructure/DesktopOverviewState.swift): `Sources/BtopDesktop/Infrastructure/DesktopOverviewState.swift`

### Other components

- **Mac user**

## Connections

- Mac user → App delegate: opens app (evidence: `README.md`)
- App delegate → Panel controller: creates panel (evidence: `Sources/BtopDesktop/App/AppDelegate.swift`)
- App delegate → Terminal runtime: starts runtime (evidence: `Sources/BtopDesktop/App/AppDelegate.swift`)
- App delegate → Preferences: loads settings (evidence: `Sources/BtopDesktop/App/AppDelegate.swift`)
- Panel controller → Terminal controller: configures terminal (evidence: `Sources/BtopDesktop/App/DesktopWindowController.swift`)
- Panel controller → Desktop panel: configures panel (evidence: `Sources/BtopDesktop/App/DesktopWindowController.swift`)
- Panel controller → Appearance state: updates appearance (evidence: `Sources/BtopDesktop/App/DesktopWindowController.swift`)
- Preferences → Panel defaults: uses defaults (evidence: `Sources/BtopDesktop/App/AppPreferences.swift`)
- Terminal controller → Terminal runtime: sends input and resize (evidence: `Sources/BtopDesktop/UI/TerminalViewController.swift`)
- Terminal controller → Native terminal view: renders terminal (evidence: `Sources/BtopDesktop/UI/TerminalViewController.swift`)
- Desktop panel → Escape filtering: filters Escape (evidence: `Sources/BtopDesktop/App/DesktopPanel.swift`)
- Terminal runtime → Process bridge: manages process (evidence: `Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift`)
- Terminal runtime → Btop configuration: prepares configuration (evidence: `Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift`)
- Terminal runtime → Theme store: validates theme (evidence: `Sources/BtopDesktop/Infrastructure/TerminalRuntime.swift`)
- Settings controller → Settings interface: handles events (evidence: `Sources/BtopDesktop/UI/SettingsWindowController.swift`)
- Settings interface → Panel defaults: edits presentation (evidence: `Sources/BtopDesktop/UI/SettingsView.swift`)
- Theme store → Btop configuration: uses configuration (evidence: `Sources/BtopDesktop/Infrastructure/BtopThemeStore.swift`)
- Theme catalog → Theme store: lists themes (evidence: `Sources/BtopDesktop/Infrastructure/BtopThemeCatalog.swift`)
- App delegate → Icon visibility: controls visibility (evidence: `Sources/BtopDesktop/App/AppDelegate.swift`)
- Panel controller → Overview monitor: tracks overview (evidence: `Sources/BtopDesktop/App/DesktopWindowController.swift`)
- Overview monitor → Overview state: updates state (evidence: `Sources/BtopDesktop/Infrastructure/DesktopOverviewMonitor.swift`)
