How freneticllc/keyboardchatterblocker works
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.