# catsovercash/mimic architecture

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

- Interactive diagram: https://gitdiagram.com/catsovercash/mimic
- Repository: https://github.com/catsovercash/mimic

## Overview

Mimic is a native Wayland macro recorder: a user records input, saves or opens a recording, then replays it with timing, loop, and pointer-position behavior. The graph follows the UI/controller into capture or playback, then the recording model and persistence. It also includes the documented settings, shortcut, and cursor-query capabilities. Some controller internals are omitted from the excerpts, so those connections are shown only where documented or left unverified.

Main entry points: [`src/ui/controller.rs`](https://github.com/catsovercash/mimic/blob/main/src/ui/controller.rs) (Session controller), [`src/input/playback.rs`](https://github.com/catsovercash/mimic/blob/main/src/input/playback.rs) (uinput playback), [`src/ui/app.rs`](https://github.com/catsovercash/mimic/blob/main/src/ui/app.rs) (egui interface), [`src/core/storage.rs`](https://github.com/catsovercash/mimic/blob/main/src/core/storage.rs) (Recording storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_main["Application entry<br/>[main.rs]"]
  node_app["egui interface<br/>[app.rs]"]
  node_widgets["UI widgets<br/>[widgets.rs]"]
  node_theme["UI theme<br/>[theme.rs]"]
  node_controller["Session controller<br/>[controller.rs]"]
end

subgraph group_recording["Recording data"]
  node_model["Recording model<br/>[model.rs]"]
  node_storage[("Recording storage<br/>[storage.rs]")]
  node_settings["User settings<br/>[settings.rs]"]
  node_paths["Data paths<br/>[paths.rs]"]
end

subgraph group_input["Input runtime"]
  node_capture["evdev capture<br/>[capture.rs]"]
  node_playback["uinput playback<br/>[playback.rs]"]
end

subgraph group_desktop["Desktop integration"]
  node_hotkeys["Global shortcuts<br/>[hotkeys.rs]"]
  node_cursor["KWin cursor query<br/>[cursor.rs]"]
end

node_user(("Desktop user"))
node_physical["Linux input devices"]
node_virtual["Linux virtual input"]
node_portal["XDG shortcut portal"]
node_kwin["KWin compositor"]
node_files[("Recording files")]

node_user -->|"launches"| node_main
node_app -->|"sends commands"| node_controller
node_controller -.->|"publishes snapshots"| node_app
node_app -.->|"uses"| node_widgets
node_app -.->|"styles with"| node_theme
node_controller -->|"starts capture"| node_capture
node_capture -->|"reads events"| node_physical
node_capture -->|"builds recordings"| node_model
node_controller -.->|"starts playback"| node_playback
node_playback -->|"replays events"| node_model
node_playback -->|"emits input"| node_virtual
node_playback -->|"queries position"| node_cursor
node_controller -.->|"records start position"| node_cursor
node_controller -.->|"loads and saves"| node_storage
node_storage -->|"validates and serializes"| node_model
node_storage -->|"reads and writes"| node_files
node_controller -.->|"manages preferences"| node_settings
node_controller -.->|"uses data locations"| node_paths
node_controller -.->|"handles shortcut updates"| node_hotkeys
node_hotkeys -->|"registers shortcuts"| node_portal
node_cursor -->|"queries cursor"| node_kwin
node_playback -->|"configures pointer"| node_kwin

click node_main "https://github.com/catsovercash/mimic/blob/main/src/main.rs"
click node_app "https://github.com/catsovercash/mimic/blob/main/src/ui/app.rs"
click node_widgets "https://github.com/catsovercash/mimic/blob/main/src/ui/app/widgets.rs"
click node_theme "https://github.com/catsovercash/mimic/blob/main/src/ui/theme.rs"
click node_controller "https://github.com/catsovercash/mimic/blob/main/src/ui/controller.rs"
click node_capture "https://github.com/catsovercash/mimic/blob/main/src/input/capture.rs"
click node_playback "https://github.com/catsovercash/mimic/blob/main/src/input/playback.rs"
click node_model "https://github.com/catsovercash/mimic/blob/main/src/core/model.rs"
click node_storage "https://github.com/catsovercash/mimic/blob/main/src/core/storage.rs"
click node_settings "https://github.com/catsovercash/mimic/blob/main/src/core/settings.rs"
click node_paths "https://github.com/catsovercash/mimic/blob/main/src/core/paths.rs"
click node_hotkeys "https://github.com/catsovercash/mimic/blob/main/src/platform/hotkeys.rs"
click node_cursor "https://github.com/catsovercash/mimic/blob/main/src/platform/cursor.rs"

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_main,node_app,node_widgets,node_theme,node_controller,node_user toneBlue
class node_model,node_storage,node_settings,node_paths,node_files toneAmber
class node_capture,node_playback toneMint
class node_hotkeys,node_cursor toneRose
class node_physical,node_virtual,node_portal,node_kwin toneIndigo
```

## Components

### User interface

- [Application entry](https://github.com/catsovercash/mimic/blob/main/src/main.rs): `src/main.rs`
- [egui interface](https://github.com/catsovercash/mimic/blob/main/src/ui/app.rs): `src/ui/app.rs`
- [UI widgets](https://github.com/catsovercash/mimic/blob/main/src/ui/app/widgets.rs): `src/ui/app/widgets.rs`
- [UI theme](https://github.com/catsovercash/mimic/blob/main/src/ui/theme.rs): `src/ui/theme.rs`
- [Session controller](https://github.com/catsovercash/mimic/blob/main/src/ui/controller.rs): `src/ui/controller.rs`

### Recording data

- [Recording model](https://github.com/catsovercash/mimic/blob/main/src/core/model.rs): `src/core/model.rs`
- [Recording storage](https://github.com/catsovercash/mimic/blob/main/src/core/storage.rs): `src/core/storage.rs`
- [User settings](https://github.com/catsovercash/mimic/blob/main/src/core/settings.rs): `src/core/settings.rs`
- [Data paths](https://github.com/catsovercash/mimic/blob/main/src/core/paths.rs): `src/core/paths.rs`

### Input runtime

- [evdev capture](https://github.com/catsovercash/mimic/blob/main/src/input/capture.rs): `src/input/capture.rs`
- [uinput playback](https://github.com/catsovercash/mimic/blob/main/src/input/playback.rs): `src/input/playback.rs`

### Desktop integration

- [Global shortcuts](https://github.com/catsovercash/mimic/blob/main/src/platform/hotkeys.rs): `src/platform/hotkeys.rs`
- [KWin cursor query](https://github.com/catsovercash/mimic/blob/main/src/platform/cursor.rs): `src/platform/cursor.rs`

### Other components

- **Desktop user**
- **Linux input devices**
- **Linux virtual input**
- **XDG shortcut portal**
- **KWin compositor**
- **Recording files**

## Connections

- Desktop user → Application entry: launches (evidence: `README.md`)
- egui interface → Session controller: sends commands (evidence: `src/ui/app.rs`)
- Session controller → egui interface: publishes snapshots
- egui interface → UI widgets: uses (evidence: `src/ui/app.rs`)
- egui interface → UI theme: styles with (evidence: `README.md`)
- Session controller → evdev capture: starts capture (evidence: `src/ui/controller.rs`)
- evdev capture → Linux input devices: reads events (evidence: `src/input/capture.rs`)
- evdev capture → Recording model: builds recordings (evidence: `src/input/capture.rs`)
- Session controller → uinput playback: starts playback (evidence: `README.md`)
- uinput playback → Recording model: replays events (evidence: `src/input/playback.rs`)
- uinput playback → Linux virtual input: emits input (evidence: `src/input/playback.rs`)
- uinput playback → KWin cursor query: queries position (evidence: `src/input/playback.rs`)
- Session controller → KWin cursor query: records start position (evidence: `README.md`)
- Session controller → Recording storage: loads and saves (evidence: `README.md`)
- Recording storage → Recording model: validates and serializes (evidence: `src/core/storage.rs`)
- Recording storage → Recording files: reads and writes (evidence: `src/core/storage.rs`)
- Session controller → User settings: manages preferences (evidence: `README.md`)
- Session controller → Data paths: uses data locations
- Session controller → Global shortcuts: handles shortcut updates (evidence: `README.md`)
- Global shortcuts → XDG shortcut portal: registers shortcuts (evidence: `src/platform/hotkeys.rs`)
- KWin cursor query → KWin compositor: queries cursor (evidence: `src/platform/cursor.rs`)
- uinput playback → KWin compositor: configures pointer (evidence: `src/input/playback.rs`)
