# oliviaophia/smarttaskbar architecture

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

- Interactive diagram: https://gitdiagram.com/oliviaophia/smarttaskbar
- Repository: https://github.com/oliviaophia/smarttaskbar

## Overview

##### Main components
- Core Application Modules:
- “Views” and “Worker” folders indicate a clear separation between the presentation layer (the system tray/menu style components) and the background business logic (engine and taskbar helper code).
- Hooking Module:
- “SmartTaskbar.Win10.Hook”: This component, which includes EasyHook libraries (EasyHook32Svc.exe, EasyHook64Svc.exe) and injection code (InjectionEntryPoint.cs), is responsible for intercepting system events or window messages. Its role is to hook into Windows processes to monitor or enforce behavior when windows interact with the taskbar.
- Packaging/Deployment Module:
- “SmartTaskbar.WapProj”: This Windows Application Packaging project deals with packaging/distributing the app – potentially for distribution via the Microsoft Store. Although packaged separately, it integrates with the core functionality.
- Ancillary Assets and Configurations:
- Files such as package.appxmanifest, app.manifest, and configuration files (App.config, packages.config) indicate how the system is built and how components are wired up.
- The “Languages” directories (with multiple resource files) highlight internationalization support.

##### Relationships and interactions
- The core modules (SmartTaskbar/SmartTaskbar.Win10) interact with helper classes to monitor focused windows and, if certain conditions are met (e.g., windows intersecting the taskbar area), trigger the auto-hide behavior.
- The Hook module (SmartTaskbar.Win10.Hook) is deployed to work transparently in the background by injecting code into system processes (using EasyHook) to detect low-level events. It communicates (or signals) the core application to adjust the taskbar display.
- The packaging project (SmartTaskbar.WapProj) wraps around the core functionality for deployment purposes.

##### Important architectural patterns or design principles
- Separation of Concerns: The project is clearly divided into modules handling UI, business logic, hooking for system integration, and deployment packaging.
- Modularity and Extensibility: The use of dedicated projects for “Win10” functionality and for hooking means that each aspect of taskbar management is isolated, which eases maintenance and potential future enhancements.
- Client-Service-like interaction: Although it isn’t a full-blown client-server application, the communication between the hook module and the core application resembles a service interaction (receiving injected events and responding appropriately).

##### Relevant technologies, frameworks, or libraries
- C# and .NET Framework/Core (as visible from the csproj files and the use of C# code).
- EasyHook library (for code injection, visible in the Win10.Hook folder).
- Windows APIs for interacting with the taskbar (via native methods in the Helpers folder).
- The system leverages Visual Studio build tools and configuration files (like packages.config and app.manifest).

- Create clearly labeled nodes for each component:
- “Core Taskbar Logic” grouping SmartTaskbar and SmartTaskbar.Win10 components (with sub-nodes for “Helpers”, “Models”, “Worker/Engine”, and “Views”).
- “System Hook Module” representing SmartTaskbar.Win10.Hook (note the use of EasyHook services and injection points).
- “Packaging & Deployment” for the SmartTaskbar.WapProj.
- From the “User Interaction Layer” to the “Core Taskbar Logic” (commands like toggle auto mode).
- From the “Core Taskbar Logic” to the Windows OS APIs for adjusting the taskbar’s state.
- From the “System Hook Module” back into “Core Taskbar Logic” to signal detected events.
- UI layers versus backend logic.
- Local modules (core logic, helper classes) versus external dependencies (EasyHook, Windows APIs).
- Configuration files and support assets as annotations or side notes if necessary to indicate build and deployment pipelines.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction Layer
    subgraph "User Interaction Layer"
        UI["Tray Icon & System Tray Menu"]:::ui
    end

    %% Core Taskbar Logic
    subgraph "Core Taskbar Logic"
        ST["SmartTaskbar"]:::core
        ST_Win10["SmartTaskbar.Win10"]:::core
        Helpers["Helpers & Native Methods"]:::core
        Worker["Worker/Engine & Taskbar Monitoring"]:::core
        Models["Models & Settings"]:::core
        Views["Views (UI Components)"]:::core
    end

    %% System Hook Module
    subgraph "System Hook Module"
        Hook["SmartTaskbar.Win10.Hook"]:::hook
    end

    %% Packaging & Deployment
    subgraph "Packaging & Deployment"
        Packaging["SmartTaskbar.WapProj"]:::pack
    end

    %% External Windows OS APIs
    OS["Windows OS (Native APIs)"]:::os

    %% Interactions
    UI -->|"toggle_auto_mode"| ST
    UI -->|"toggle_auto_mode"| ST_Win10

    ST -->|"uses"| Helpers
    ST -->|"executes"| Worker
    ST -->|"contains"| Models
    ST -->|"displays"| Views

    ST_Win10 -->|"uses"| Helpers
    ST_Win10 -->|"executes"| Worker
    ST_Win10 -->|"contains"| Models
    ST_Win10 -->|"displays"| Views

    Worker -->|"calls"| OS
    Helpers -->|"invokes"| OS

    Hook -->|"signals"| Worker
    Hook -->|"signals"| Helpers

    Packaging -->|"wraps"| ST
    Packaging -->|"wraps"| ST_Win10

    %% Click Events
    click ST "https://github.com/oliviaophia/smarttaskbar/tree/main/Sources/SmartTaskbar"
    click ST_Win10 "https://github.com/oliviaophia/smarttaskbar/blob/main/Sources/SmartTaskbar.Win10"
    click Hook "https://github.com/oliviaophia/smarttaskbar/blob/main/Sources/SmartTaskbar.Win10.Hook"
    click Packaging "https://github.com/oliviaophia/smarttaskbar/blob/main/Sources/SmartTaskbar.WapProj"

    %% Styles
    classDef ui fill:#FFEEAA,stroke:#333,stroke-width:2px;
    classDef core fill:#FFDDAA,stroke:#333,stroke-width:2px;
    classDef hook fill:#D0F0C0,stroke:#333,stroke-width:2px;
    classDef pack fill:#CCE5FF,stroke:#333,stroke-width:2px;
    classDef os fill:#FDD,stroke:#333,stroke-width:2px;
```
