# ther0n/unnaturalscrollwheels architecture

> Architecture diagram of the GitHub repository ther0n/unnaturalscrollwheels, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ther0n/unnaturalscrollwheels
- Repository: https://github.com/ther0n/unnaturalscrollwheels

## Overview

1. AutoLauncher – This component appears to be a dedicated small executable (with its own AppDelegate, main.swift, etc.) which likely handles launching the main application automatically (e.g., at system startup or when needed). It has its own entitlements, indicating that it might have specific permissions separate from the main application.

- Bridging header files which suggest that this project might integrate some Objective-C components if needed.

##### Main Components
- UnnaturalScrollWheels Application Core:
- UI Module: Includes the menu bar item, preferences window, and related storyboard/layout files.
- Scroll Interception Module: Encapsulated in ScrollInterceptor.swift along with related modules (like DisableMouseAccel.swift) that handle the logic for inverting the scroll direction.
- Preferences/Settings Module: Managed through Options.swift and coordinated with the PreferencesViewController, ensuring user preferences are applied.

##### External/System Interactions
- macOS System Settings: While not directly controlled by the app, including an indicator for system settings (e.g., Mouse and Trackpad settings) can help explain the problem context the app is addressing.

##### Architectural Patterns/Design Principles
- Separation of Concerns: Emphasize the clear split between UI components (menu bar, preferences view) and backend event handling (scroll interception, disabling acceleration, etc.).
- Modularity: The division between the AutoLauncher and the main application underscores an approach to keep the auto-launch functionality isolated from the core logic.
- How the AutoLauncher initiates the main application.
- How the UI (preferences window) sends updates to the Options module, which in turn affects the behavior of the Scroll Interceptor.
- The data flow between the Scroll Interceptor and the macOS Accessibility APIs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "AutoLauncher Component"
        AL["AutoLauncher"]:::autoColor
    end

    subgraph "UnnaturalScrollWheels Core"
        subgraph "UI & Interaction Layer"
            UI["UI Module"]:::uiColor
            MB["Menu Bar Module"]:::uiColor
            UI -->|"Displays_icon"| MB
        end
        subgraph "Core Processing Layer"
            SI["Scroll Interceptor"]:::coreColor
            DMA["Disable Mouse Acceleration"]:::coreColor
            PM["Preferences Module"]:::coreColor
            BH["Objective-C Bridging"]:::coreColor
        end
    end

    OSAPI["macOS Accessibility API"]:::systemColor
    OSSET["macOS System Settings"]:::systemColor

    AL -->|"Launch_Trigger"| UI
    UI -->|"UserSettings_Update"| PM
    PM -->|"Config_Update"| SI
    PM -->|"Config_Update"| DMA
    BH -->|"Bridging"| SI
    OSAPI -->|"Scroll_Events"| SI
    SI -->|"Modified_Events"| OSAPI
    OSSET -->|"System_Config"| OSAPI

    click AL "https://github.com/ther0n/unnaturalscrollwheels/tree/master/AutoLauncher/"
    click UI "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/AppDelegate.swift"
    click UI "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/PreferencesViewController.swift"
    click UI "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/Base.lproj/Main.storyboard"
    click UI "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/Assets.xcassets/AppIcon.appiconset"
    click MB "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/MenuBarItem.swift"
    click SI "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/ScrollInterceptor.swift"
    click DMA "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/DisableMouseAccel.swift"
    click PM "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/Options.swift"
    click BH "https://github.com/ther0n/unnaturalscrollwheels/blob/master/UnnaturalScrollWheels/UnnaturalScrollWheels-Bridging-Header.h"

    classDef autoColor fill:#FFD700,stroke:#000,stroke-width:2px
    classDef uiColor fill:#87CEEB,stroke:#000,stroke-width:2px
    classDef coreColor fill:#90EE90,stroke:#000,stroke-width:2px
    classDef systemColor fill:#FFB6C1,stroke:#000,stroke-width:2px
```
