# felipeheuer/usb_kb_layout architecture

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

- Interactive diagram: https://gitdiagram.com/felipeheuer/usb_kb_layout
- Repository: https://github.com/felipeheuer/usb_kb_layout

## Overview

This repository provides a small Linux utility that applies a chosen layout to an external USB keyboard when it is connected. The documented workflow configures a udev rule and layout options, then checks a log for the result. The README identifies the rule and scripts but provides no source excerpts, so the links between runtime components are shown as unverified rather than asserted as documented calls.

Main entry points: [`usb_kb_layout.sh`](https://github.com/felipeheuer/usb_kb_layout/blob/main/usb_kb_layout.sh) (Layout settings), [`99-usb-keyboard.rules`](https://github.com/felipeheuer/usb_kb_layout/blob/main/99-usb-keyboard.rules) (udev rule), [`usb_kb_layout_wrapper.sh`](https://github.com/felipeheuer/usb_kb_layout/blob/main/usb_kb_layout_wrapper.sh) (Layout wrapper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_trigger["Device trigger"]
  node_udev["udev rule"]
end

subgraph group_layout["Layout handling"]
  node_wrapper["Layout wrapper"]
  node_layout_script["Layout settings<br/>[usb_kb_layout.sh]"]
end

subgraph group_system["System effects"]
  node_input["Keyboard layout"]
  node_log[("Activity log")]
end

node_keyboard(("USB keyboard"))

node_keyboard -.->|"triggers on connect"| node_udev
node_udev -.->|"invokes"| node_wrapper
node_wrapper -.->|"runs settings"| node_layout_script
node_layout_script -.->|"updates layout"| node_input
node_layout_script -.->|"records updates"| node_log

click node_udev "https://github.com/felipeheuer/usb_kb_layout/blob/main/99-usb-keyboard.rules"
click node_wrapper "https://github.com/felipeheuer/usb_kb_layout/blob/main/usb_kb_layout_wrapper.sh"
click node_layout_script "https://github.com/felipeheuer/usb_kb_layout/blob/main/usb_kb_layout.sh"

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_udev toneBlue
class node_wrapper,node_layout_script toneAmber
class node_input,node_log toneMint
class node_keyboard toneIndigo
```

## Components

### Device trigger

- [udev rule](https://github.com/felipeheuer/usb_kb_layout/blob/main/99-usb-keyboard.rules): `99-usb-keyboard.rules`

### Layout handling

- [Layout wrapper](https://github.com/felipeheuer/usb_kb_layout/blob/main/usb_kb_layout_wrapper.sh): `usb_kb_layout_wrapper.sh`
- [Layout settings](https://github.com/felipeheuer/usb_kb_layout/blob/main/usb_kb_layout.sh): `usb_kb_layout.sh`

### System effects

- **Keyboard layout**
- **Activity log**

### Other components

- **USB keyboard**

## Connections

- USB keyboard → udev rule: triggers on connect
- udev rule → Layout wrapper: invokes
- Layout wrapper → Layout settings: runs settings
- Layout settings → Keyboard layout: updates layout
- Layout settings → Activity log: records updates
