# samaliyan/keyswitchfix architecture

> Architecture diagram of the GitHub repository samaliyan/keyswitchfix, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/samaliyan/keyswitchfix
- Repository: https://github.com/samaliyan/keyswitchfix

## Overview

KeySwitchFix is a native Windows keyboard-layout repair application with offline spelling correction and typing aids. The main workflow is physical keystrokes in a target app, detection and correction by the app’s keyboard engine, then replacement text and a layout change in that app. The graph separates the Win32 runtime, language decision logic, and supporting vocabularies and personalization. README-described features are included, but implementation details beyond the sampled excerpts are not inferred; README citations mark documented relationships.

Main entry points: [`src/app.c`](https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c) (Keyboard handling), [`src/core.c`](https://github.com/samaliyan/keyswitchfix/blob/main/src/core.c) (Language decisions), [`src/typing.c`](https://github.com/samaliyan/keyswitchfix/blob/main/src/typing.c) (Typing helpers), [`src/spell.c`](https://github.com/samaliyan/keyswitchfix/blob/main/src/spell.c) (Spelling correction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Windows runtime"]
  node_keyboard["Keyboard handling<br/>[app.c]"]
  node_dashboard["Dashboard and tray<br/>[app.c]"]
  node_layout["Layout repair<br/>[app.c]"]
  node_typing["Typing helpers<br/>[typing.c]"]
  node_stats["Usage statistics<br/>[typing.c]"]
  node_installer["Setup and install<br/>[installer.c]"]
end

subgraph group_engine["Correction engine"]
  node_core["Language decisions<br/>[core.c]"]
  node_spelling["Spelling correction<br/>[spell.c]"]
end

subgraph group_support["Language and personalization"]
  node_domain["IT vocabulary<br/>[domain.c]"]
  node_memory[("Writing memory<br/>[memory.c]")]
  node_dictionaries[("Built-in dictionaries")]
  node_languagepacks[("Language packs<br/>[app.c]")]
end

node_user(("User typing"))
node_target["Target application"]

node_user -->|"types into"| node_keyboard
node_keyboard -->|"evaluates text"| node_core
node_core -->|"checks words"| node_dictionaries
node_core -->|"uses pair data"| node_languagepacks
node_core -->|"checks terms"| node_domain
node_keyboard -->|"checks unknown words"| node_spelling
node_spelling -->|"uses learned words"| node_memory
node_keyboard -->|"learns repairs"| node_memory
node_keyboard -->|"applies helpers"| node_typing
node_typing -->|"updates counts"| node_stats
node_keyboard -->|"requests correction"| node_layout
node_layout -->|"retypes and switches"| node_target
node_dashboard -->|"configures behavior"| node_keyboard
node_dashboard -->|"shows statistics"| node_stats
node_installer -->|"installs bundle"| node_languagepacks

click node_keyboard "https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c"
click node_dashboard "https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c"
click node_layout "https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c"
click node_typing "https://github.com/samaliyan/keyswitchfix/blob/main/src/typing.c"
click node_stats "https://github.com/samaliyan/keyswitchfix/blob/main/src/typing.c"
click node_core "https://github.com/samaliyan/keyswitchfix/blob/main/src/core.c"
click node_spelling "https://github.com/samaliyan/keyswitchfix/blob/main/src/spell.c"
click node_domain "https://github.com/samaliyan/keyswitchfix/blob/main/src/domain.c"
click node_memory "https://github.com/samaliyan/keyswitchfix/blob/main/src/memory.c"
click node_dictionaries "https://github.com/samaliyan/keyswitchfix/tree/main/resources"
click node_languagepacks "https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c"
click node_installer "https://github.com/samaliyan/keyswitchfix/blob/main/src/installer.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_keyboard,node_dashboard,node_layout,node_typing,node_stats,node_installer,node_user toneBlue
class node_core,node_spelling toneAmber
class node_domain,node_memory,node_dictionaries,node_languagepacks toneMint
class node_target toneIndigo
```

## Components

### Windows runtime

- [Keyboard handling](https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c): `src/app.c`
- [Dashboard and tray](https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c): `src/app.c`
- [Layout repair](https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c): `src/app.c`
- [Typing helpers](https://github.com/samaliyan/keyswitchfix/blob/main/src/typing.c): `src/typing.c`
- [Usage statistics](https://github.com/samaliyan/keyswitchfix/blob/main/src/typing.c): `src/typing.c`
- [Setup and install](https://github.com/samaliyan/keyswitchfix/blob/main/src/installer.c): `src/installer.c`

### Correction engine

- [Language decisions](https://github.com/samaliyan/keyswitchfix/blob/main/src/core.c): `src/core.c`
- [Spelling correction](https://github.com/samaliyan/keyswitchfix/blob/main/src/spell.c): `src/spell.c`

### Language and personalization

- [IT vocabulary](https://github.com/samaliyan/keyswitchfix/blob/main/src/domain.c): `src/domain.c`
- [Writing memory](https://github.com/samaliyan/keyswitchfix/blob/main/src/memory.c): `src/memory.c`
- [Built-in dictionaries](https://github.com/samaliyan/keyswitchfix/tree/main/resources): `resources`
- [Language packs](https://github.com/samaliyan/keyswitchfix/blob/main/src/app.c): `src/app.c`

### Other components

- **User typing**
- **Target application**

## Connections

- User typing → Keyboard handling: types into (evidence: `README.md`)
- Keyboard handling → Language decisions: evaluates text (evidence: `README.md`)
- Language decisions → Built-in dictionaries: checks words (evidence: `README.md`)
- Language decisions → Language packs: uses pair data (evidence: `README.md`)
- Language decisions → IT vocabulary: checks terms (evidence: `README.md`)
- Keyboard handling → Spelling correction: checks unknown words (evidence: `README.md`)
- Spelling correction → Writing memory: uses learned words (evidence: `README.md`)
- Keyboard handling → Writing memory: learns repairs (evidence: `README.md`)
- Keyboard handling → Typing helpers: applies helpers (evidence: `README.md`)
- Typing helpers → Usage statistics: updates counts (evidence: `README.md`)
- Keyboard handling → Layout repair: requests correction (evidence: `README.md`)
- Layout repair → Target application: retypes and switches (evidence: `README.md`)
- Dashboard and tray → Keyboard handling: configures behavior (evidence: `README.md`)
- Dashboard and tray → Usage statistics: shows statistics (evidence: `README.md`)
- Setup and install → Language packs: installs bundle (evidence: `README.md`)
