# tombonez/notunes architecture

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

- Interactive diagram: https://gitdiagram.com/tombonez/notunes
- Repository: https://github.com/tombonez/notunes

## Overview

noTunes is a macOS menu-bar app that blocks iTunes and Apple Music from opening. At launch, it sets up the status-bar control, optionally hides the icon from saved preferences, terminates any already-running target apps, and observes future application launches. The enabled state blocks targets; an optional replacement setting launches another app or URL through macOS `open`. The implementation is concentrated in one sampled source file, so the nodes distinguish its responsibilities rather than implying separate modules.

Main entry points: [`noTunes/AppDelegate.swift`](https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift) (noTunes App Delegate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_controls["Menu Bar Controls"]
  node_app["noTunes App Delegate<br/>[AppDelegate.swift]"]
  node_status["Status Bar Control<br/>[AppDelegate.swift]"]
  node_preferences["Saved Preferences<br/>[AppDelegate.swift]"]
end

subgraph group_blocking["Launch Blocking"]
  node_workspace["macOS Workspace"]
  node_launch_observer["Launch Observer<br/>[AppDelegate.swift]"]
  node_running_apps["Running App Check<br/>[AppDelegate.swift]"]
  node_target_apps["iTunes and Music"]
end

subgraph group_replacement["Replacement Launch"]
  node_replacement_handler["Replacement Handler<br/>[AppDelegate.swift]"]
  node_open_service["macOS open Service"]
  node_replacement_target["Configured Replacement"]
end

node_user(("User"))

node_user -->|"clicks"| node_status
node_app -->|"configures"| node_status
node_app -->|"reads"| node_preferences
node_app -->|"checks at launch"| node_running_apps
node_app -->|"registers"| node_launch_observer
node_status -->|"toggles blocking"| node_running_apps
node_launch_observer -->|"observes launches"| node_workspace
node_launch_observer -->|"terminates targets"| node_target_apps
node_launch_observer -->|"invokes on target"| node_replacement_handler
node_running_apps -->|"terminates running"| node_target_apps
node_replacement_handler -->|"reads replacement"| node_preferences
node_replacement_handler -->|"launches via"| node_open_service
node_open_service -->|"opens"| node_replacement_target

click node_app "https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift"
click node_status "https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift"
click node_preferences "https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift"
click node_launch_observer "https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift"
click node_running_apps "https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift"
click node_replacement_handler "https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.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_status,node_preferences,node_user toneBlue
class node_workspace,node_launch_observer,node_running_apps,node_target_apps toneAmber
class node_replacement_handler,node_open_service,node_replacement_target toneMint
```

## Components

### Menu Bar Controls

- [noTunes App Delegate](https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift): `noTunes/AppDelegate.swift`
- [Status Bar Control](https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift): `noTunes/AppDelegate.swift`
- [Saved Preferences](https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift): `noTunes/AppDelegate.swift`

### Launch Blocking

- **macOS Workspace**
- [Launch Observer](https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift): `noTunes/AppDelegate.swift`
- [Running App Check](https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift): `noTunes/AppDelegate.swift`
- **iTunes and Music**

### Replacement Launch

- [Replacement Handler](https://github.com/tombonez/notunes/blob/master/noTunes/AppDelegate.swift): `noTunes/AppDelegate.swift`
- **macOS open Service**
- **Configured Replacement**

### Other components

- **User**

## Connections

- User → Status Bar Control: clicks (evidence: `README.md`)
- noTunes App Delegate → Status Bar Control: configures (evidence: `noTunes/AppDelegate.swift`)
- noTunes App Delegate → Saved Preferences: reads (evidence: `noTunes/AppDelegate.swift`)
- noTunes App Delegate → Running App Check: checks at launch (evidence: `noTunes/AppDelegate.swift`)
- noTunes App Delegate → Launch Observer: registers (evidence: `noTunes/AppDelegate.swift`)
- Status Bar Control → Running App Check: toggles blocking (evidence: `noTunes/AppDelegate.swift`)
- Launch Observer → macOS Workspace: observes launches (evidence: `noTunes/AppDelegate.swift`)
- Launch Observer → iTunes and Music: terminates targets (evidence: `noTunes/AppDelegate.swift`)
- Launch Observer → Replacement Handler: invokes on target (evidence: `noTunes/AppDelegate.swift`)
- Running App Check → iTunes and Music: terminates running (evidence: `noTunes/AppDelegate.swift`)
- Replacement Handler → Saved Preferences: reads replacement (evidence: `noTunes/AppDelegate.swift`)
- Replacement Handler → macOS open Service: launches via (evidence: `noTunes/AppDelegate.swift`)
- macOS open Service → Configured Replacement: opens
