# freneticllc/keyboardchatterblocker architecture

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

- Interactive diagram: https://gitdiagram.com/freneticllc/keyboardchatterblocker
- Repository: https://github.com/freneticllc/keyboardchatterblocker

## Overview

##### Project Type and Purpose
- This is a desktop Windows tool built in .NET (using Windows Forms) that intercepts keyboard input to filter rapid, unintended repeat keystrokes (“chatter”).
- The application offers both a graphical user interface (GUI) for configuration and an underlying key interception/filtering component. It even supports deployment via an installer and Chocolatey packaging.

##### Analyzing the File Structure
- Core Code: All primary source files are inside the “KeyboardChatterBlocker” directory. This includes:
– GUI Forms (e.g., MainBlockerForm, KeyConfigurationForm, NeedInputForm) for user interactions.
– Core classes (e.g., KeyBlocker, KeyboardInterceptor, AcceleratedKeyMap) that encapsulate the logic to detect and block rapid keystroke chatter.
– Utility modules (e.g., KeysHelper, FullScreenDetectHelper, KBCUtils) managing key mappings or full-screen detection.
- Configuration: The application uses a “config.txt” file (described in the README) for settings, with keys that determine the per-key threshold values and other options.
- Deployment and Packaging: There are folders (WindowsInstaller and “other” with chocolatey-files) related to building and deploying the app.
- Build & Project Files: The .sln and .csproj files confirm it’s a Visual Studio .NET project.

##### Key Components
a. User Interface (UI)
– MainBlockerForm: Displays status, options to enable/disable the blocker and shows settings.
– KeyConfigurationForm: Allows per-key configuration for chatter thresholds.
– NeedInputForm: Likely used for additional key input or configuration.
b. Keyboard Interception & Blocking Logic
– KeyboardInterceptor: Hooks into Windows’ keyboard events.
– KeyBlocker and related classes (e.g., HotKeys, KeysHelper): Implement logic to detect chatter, filter key repetitions, and apply user-defined thresholds.
c. Configuration and Settings Management
– App.config and the externally stored “config.txt”: Manage runtime configuration parameters (global threshold, per-key settings, hotkeys, and auto-disable logic).
d. Utility Modules
– Helpers like FullScreenDetectHelper and AcceleratedKeyMap that implement specialized functionality (like detecting full-screen apps or optimizing key mapping behavior).
e. Packaging/Deployment
– WindowsInstaller folder: Contains installer setup files.
– Other packaging scripts/files: Chocolatey nuspec file, batch scripts for releases, and hash computations.

##### Relationships and Interactions
- The UI components directly interact with the configuration module to read and update key settings.
- The Keyboard Interceptor continuously captures low-level keystrokes and passes events to the KeyBlocker module.
- The KeyBlocker consults the configuration (global and per-key thresholds) to decide whether to block or allow a given keypress.
- Utility components (such as full-screen detection or hotkey management) modify the behavior of the interceptor and blocker based on current system conditions.
- Deployment components are separate from runtime logic, but they package the binary and supporting files for distribution.

##### Architectural Patterns and Design Principles
- Modular Design: Separates key interception, filtering logic, GUI, and configuration management to ensure clear separation of concerns.
- Event-Driven Architecture: Central to capturing and processing keyboard events, with modules responsive to input as it flows through the system.
- Configuration-driven Customization: Both the UI and backend rely on a easily editable configuration file for per-key settings and hotkey definitions.
- Use of Windows Forms for a clean, desktop-native user experience and direct integration with Windows APIs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface"
        MBF["MainBlockerForm (displays status/out options)"]:::ui
        KCF["KeyConfigurationForm (per-key configuration)"]:::ui
        NIF["NeedInputForm (additional key input)"]:::ui
    end

    subgraph "Keyboard Interception & Blocking"
        KI["KeyboardInterceptor (captures keystrokes)"]:::core
        KB["KeyBlocker (processes key events)"]:::core
        HK["HotKeys (manages shortcuts)"]:::core
        KH["KeysHelper (assists key blocking)"]:::core
    end

    subgraph "Configuration Manager"
        AC["App.config (application settings)"]:::config
    end

    subgraph "Utility Modules"
        AKM["AcceleratedKeyMap (optimized key mapping)"]:::util
        FSD["FullScreenDetectHelper (detects full-screen apps)"]:::util
        KBCU["KBCUtils (utility methods)"]:::util
    end

    subgraph "Deployment & Packaging"
        WI["Windows Installer (installer setup)"]:::deploy
        CH["Chocolatey Packaging (nuspec & scripts)"]:::deploy
    end

    %% Relationships
    MBF -->|"load/update"| AC
    KCF -->|"load/update"| AC
    NIF -->|"load/update"| AC

    KI -->|"sendsEvents"| KB
    KB -->|"notifiesUI"| MBF

    FSD -->|"influences"| KI
    AKM -->|"optimizes"| KB
    KBCU -->|"supports"| KB

    %% Styles
    classDef ui fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef core fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef config fill:#ffe4b5,stroke:#000,stroke-width:2px;
    classDef util fill:#ffd700,stroke:#000,stroke-width:2px;
    classDef deploy fill:#ffb6c1,stroke:#000,stroke-width:2px;

    %% Click Events for User Interface Components
    click MBF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/MainBlockerForm.cs"
    click MBF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/MainBlockerForm.Designer.cs"
    click MBF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/MainBlockerForm.resx"

    click KCF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KeyConfigurationForm.cs"
    click KCF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KeyConfigurationForm.Designer.cs"
    click KCF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KeyConfigurationForm.resx"

    click NIF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/NeedInputForm.cs"
    click NIF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/NeedInputForm.Designer.cs"
    click NIF "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/NeedInputForm.resx"

    %% Click Events for Keyboard Interception & Blocking Components
    click KI "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KeyboardInterceptor.cs"
    click KB "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KeyBlocker.cs"
    click KB "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KeyBlockedEventArgs.cs"
    click HK "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/HotKeys.cs"
    click KH "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KeysHelper.cs"

    %% Click Event for Configuration
    click AC "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/App.config"

    %% Click Events for Utility Modules
    click AKM "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/AcceleratedKeyMap.cs"
    click FSD "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/FullScreenDetectHelper.cs"
    click KBCU "https://github.com/freneticllc/keyboardchatterblocker/blob/master/KeyboardChatterBlocker/KBCUtils.cs"

    %% Click Events for Deployment & Packaging
    click WI "https://github.com/freneticllc/keyboardchatterblocker/blob/master/WindowsInstaller/WindowsInstaller.vdproj"
    click CH "https://github.com/freneticllc/keyboardchatterblocker/blob/master/other/chocolatey-files/keyboard-chatter-blocker.nuspec"
    click CH "https://github.com/freneticllc/keyboardchatterblocker/blob/master/other/chocolatey-release.bat"
    click CH "https://github.com/freneticllc/keyboardchatterblocker/blob/master/other/hash.bat"
    click CH "https://github.com/freneticllc/keyboardchatterblocker/blob/master/other/release.bat"
```
