# jaredks/rumps architecture

> Architecture diagram of the GitHub repository jaredks/rumps, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaredks/rumps
- Repository: https://github.com/jaredks/rumps

## Overview

##### Main Components

a. Core Library Components:
- Main Application Handler (rumps.App)
- Menu System
- Event System
- Notification System
- Timer System

b. Integration Layer:
- PyObjC Bridge
- macOS System Integration

c. User Application Layer:
- Client Application Code
- Custom Menu Items
- Event Handlers

**┌─────────────────────────────────────────┐**
- Client Application            │
- ┬─────────────────────┘
- ↓
**┌─────────────────────────────────────────┐**
- rumps Library              │
- ┬─────────────┬─────────────┤
- App Class  │Menu System  │Timer System │
- ┼─────────────┼─────────────┤
- Events    │Notifications│  Utilities  │
- ┴──────┬──────┴─────────────┘
- ↓
**┌─────────────────────────────────────────┐**
- macOS System Integration         │
- (via PyObjC)              │
- ┘

##### Component Details

- Rectangles: Main system components
- Rounded rectangles: Interface components
- Hexagons: External system integrations
- Circles: Event handlers

- Blue: Core rumps components
- Green: User application layer
- Gray: System integration layer
- Yellow: Event system components

##### Key Relationships

- Event flow from system events up through the layers
- Notification flow from the application down to the system
- Demonstrate timer event propagation

##### Implementation Details

- File organization structure (matching the project's layout)
- Key class relationships (App, MenuItem, Timer)
- Event handling system
- Configuration flow

##### Notes

- Keep the focus on the statusbar app architecture
- Clear separation between library and user code
- Event-driven nature of the system
- Example flows for common operations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Application Layer"]
        ClientApp["Client Application"]:::client
        CustomMenu["Custom Menu Items"]:::client
        EventHandlers["Event Handlers"]:::client
    end

    subgraph Core["rumps Library Core"]
        AppHandler["Main Application Handler"]:::core
        MenuSystem["Menu System"]:::core
        EventSystem["Event System"]:::core
        NotifSystem["Notification System"]:::core
        TimerSystem["Timer System"]:::core
        Utils["Utilities"]:::core
        TextField["Text Field Component"]:::core
    end

    subgraph Integration["System Integration Layer"]
        PyObjC["PyObjC Bridge"]:::integration
        MacOS["macOS System"]:::integration
    end

    subgraph Examples["Example Implementations"]
        ExTimer["Timer Examples"]:::example
        ExMenu["Menu Examples"]:::example
        ExSimple["Basic Usage"]:::example
        ExDynamic["Dynamic Features"]:::example
    end

    subgraph Documentation["Component Documentation"]
        DocApp["App Documentation"]:::doc
        DocMenu["MenuItem Documentation"]:::doc
        DocTimer["Timer Documentation"]:::doc
        DocNotif["Notifications Documentation"]:::doc
    end

    subgraph Tests["Testing Components"]
        TestInternal["Internal Tests"]:::test
        TestNotif["Notification Tests"]:::test
        TestUtils["Utilities Tests"]:::test
    end

    %% Relationships
    ClientApp --> AppHandler
    CustomMenu --> MenuSystem
    EventHandlers --> EventSystem

    AppHandler --> PyObjC
    MenuSystem --> PyObjC
    EventSystem --> PyObjC
    NotifSystem --> PyObjC
    TimerSystem --> PyObjC

    PyObjC --> MacOS

    %% Click Events
    click AppHandler "https://github.com/jaredks/rumps/blob/master/rumps/rumps.py"
    click EventSystem "https://github.com/jaredks/rumps/blob/master/rumps/events.py"
    click NotifSystem "https://github.com/jaredks/rumps/blob/master/rumps/notifications.py"
    click PyObjC "https://github.com/jaredks/rumps/blob/master/rumps/_internal.py"
    click Utils "https://github.com/jaredks/rumps/blob/master/rumps/utils.py"
    click TextField "https://github.com/jaredks/rumps/blob/master/rumps/text_field.py"
    click ExTimer "https://github.com/jaredks/rumps/blob/master/examples/example_timers.py"
    click ExMenu "https://github.com/jaredks/rumps/blob/master/examples/example_menu.py"
    click ExSimple "https://github.com/jaredks/rumps/blob/master/examples/example_simple.py"
    click ExDynamic "https://github.com/jaredks/rumps/blob/master/examples/example_dynamic_title_icon.py"
    click DocApp "https://github.com/jaredks/rumps/blob/master/docs/App.rst"
    click DocMenu "https://github.com/jaredks/rumps/blob/master/docs/MenuItem.rst"
    click DocTimer "https://github.com/jaredks/rumps/blob/master/docs/Timer.rst"
    click DocNotif "https://github.com/jaredks/rumps/blob/master/docs/notifications.rst"
    click TestInternal "https://github.com/jaredks/rumps/blob/master/tests/test_internal.py"
    click TestNotif "https://github.com/jaredks/rumps/blob/master/tests/test_notifications.py"
    click TestUtils "https://github.com/jaredks/rumps/blob/master/tests/test_utils.py"

    %% Styling
    classDef core fill:#2374ab
    classDef client fill:#57cc99
    classDef integration fill:#808080
    classDef example fill:#ffd60a
    classDef doc fill:#c8b6ff
    classDef test fill:#ff7f51

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Client Layer"]:::client
        L3["System Integration"]:::integration
        L4["Examples"]:::example
        L5["Documentation"]:::doc
        L6["Tests"]:::test
    end
```
