# Architecture EPOD Window Bar is a macOS agent application. It shows a strip of window tabs above the Dock. This document gives a short overview of the module groups and the data flow. ## Data flow The tracking group reads the windows and writes the `WindowStore`. The strip observes the `WindowStore` and shows the tabs of the frontmost application. A click on a tab calls the activation group. A window move or resize event drives the constraint group. The `AppDelegate` creates every group and connects them. ``` WorkspaceEvents + AppObserverRegistry │ (events) ▼ TrackingController ──► WindowEnumerator ──► WindowStore (@Observable) │ │ │ focused window / full screen │ observe ▼ ▼ StripController ◄──────────────────────── TabBarView │ onActivate / onMinimize / onClose ▼ WindowActivator WindowConstraintService ◄── geometry events ``` ## Module groups ### App The `main.swift` file starts the application on the main actor. `AppDelegate` creates every service and connects the closures between them. `AppDelegate` implements `AppControl`, the interface that the menu and the settings window use. `MenuBarController` owns the status item and the menu. `LaunchAtLogin` wraps `SMAppService.mainApp`. ### Permissions `PermissionManager` reads the Accessibility state and the Screen Recording state. The manager polls every 2 s and reports a change. `OnboardingWindow` explains each permission and opens the correct System Settings pane. ### Model `WindowInfo` is the value type for one window. `WindowStore` holds the windows per application and the frontmost PID. The store is `@MainActor` and `@Observable`. `AXElementCache` holds the AX element for each window in a separate cache. The value type does not hold the AX element. ### Tracking `WindowEnumerator` reads the windows from the AX source and the CGWindowList source and merges them. The enumerator applies the filter rules. `AppObserverRegistry` keeps one `AXObserver` per regular application. `WorkspaceEvents` subscribes to the `NSWorkspace` notifications. `TrackingController` ties the three together. The controller runs every AX call on one serial queue and writes the `WindowStore` on the main actor. ### Private `PrivateAPI` loads the private symbols with `dlsym`. If a symbol is missing, the feature is disabled and the application does not crash. `PrivateAPI` is nonisolated, so the serial AX queue can call the wrappers. `SpaceService` reports the Space of each window through `PrivateAPI`. ### Actions `WindowActivator` raises a window, restores a minimized window, and activates a window on another Space. The activator minimizes and closes a window for the context menu. ### Constraint `ConstraintMath` holds the pure math for the window limit line. The math is unit-tested. `WindowConstraintService` keeps a window above the strip. The service debounces the events, protects against a loop, and keeps a runtime blacklist. ### Strip `StripPanel` is the borderless, non-activating `NSPanel`. `StripPositioner` computes the frame above the Dock. `TabLayout` is the pure layout math for the tabs and is unit-tested. `TabBarView` is the SwiftUI view in an `NSHostingView`. `StripController` owns the panel and the view and forwards the tab actions through closures. ### Settings `Settings` wraps `UserDefaults` with the `ws.` keys. `SettingsWindow` shows the excluded applications list with Add and Remove. ### Util `Geometry` converts between the Cocoa coordinate system and the AX coordinate system. The conversion is unit-tested. `Log` holds the `os.Logger` instances.