# md-ruwaid/multi-clip architecture

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

- Interactive diagram: https://gitdiagram.com/md-ruwaid/multi-clip
- Repository: https://github.com/md-ruwaid/multi-clip

## Overview

Numpad Clipboard is a Windows-oriented desktop utility that captures copied text into nine rotating in-memory slots and pastes a chosen slot with Ctrl+Numpad. Its runtime is concentrated in one Rust file: a clipboard watcher maintains slots, global shortcuts and tray actions control capture and slot operations, and a Tauri overlay reports slot state. The README also documents clear, toggle, and tray controls. Frontend internals are not shown, so the overlay is represented only as the documented popup. Evidence is limited to the README and sampled Rust source.

Main entry points: [`src-tauri/src/main.rs`](https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs) (Clipboard watcher), [`src/index.html`](https://github.com/md-ruwaid/multi-clip/blob/master/src/index.html) (Slots popup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Clipboard capture"]
  node_watcher["Clipboard watcher<br/>[main.rs]"]
  node_slots[("Slot state<br/>[main.rs]")]
end

subgraph group_controls["Controls and paste"]
  node_shortcut["Shortcut handler<br/>[main.rs]"]
  node_paste["Paste slot<br/>[main.rs]"]
end

subgraph group_desktop["Desktop interface"]
  node_tray["Tray menu<br/>[main.rs]"]
  node_statecmd["State command<br/>[main.rs]"]
  node_overlay["Slots popup<br/>[index.html]"]
end

node_user(("User"))
node_clipboard["System clipboard"]
node_target["Foreground app"]

node_user -->|"presses shortcut"| node_shortcut
node_user -->|"uses menu"| node_tray
node_watcher -->|"reads text"| node_clipboard
node_watcher -->|"stores copy"| node_slots
node_watcher -->|"notifies slots"| node_overlay
node_shortcut -->|"dispatches paste"| node_paste
node_shortcut -->|"toggles capture"| node_watcher
node_shortcut -->|"clears slots"| node_slots
node_paste -->|"reads slot"| node_slots
node_paste -->|"sets and restores"| node_clipboard
node_paste -->|"types paste"| node_target
node_tray -->|"toggles capture"| node_watcher
node_tray -->|"clears slots"| node_slots
node_tray -->|"shows popup"| node_overlay
node_statecmd -->|"returns snapshot"| node_slots
node_watcher -->|"shows popup"| node_overlay

click node_watcher "https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs"
click node_slots "https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs"
click node_shortcut "https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs"
click node_paste "https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs"
click node_tray "https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs"
click node_statecmd "https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs"
click node_overlay "https://github.com/md-ruwaid/multi-clip/blob/master/src/index.html"

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_watcher,node_slots,node_user toneBlue
class node_shortcut,node_paste toneAmber
class node_tray,node_statecmd,node_overlay toneMint
class node_clipboard,node_target toneIndigo
```

## Components

### Clipboard capture

- [Clipboard watcher](https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs): `src-tauri/src/main.rs`
- [Slot state](https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs): `src-tauri/src/main.rs`

### Controls and paste

- [Shortcut handler](https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs): `src-tauri/src/main.rs`
- [Paste slot](https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs): `src-tauri/src/main.rs`

### Desktop interface

- [Tray menu](https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs): `src-tauri/src/main.rs`
- [State command](https://github.com/md-ruwaid/multi-clip/blob/master/src-tauri/src/main.rs): `src-tauri/src/main.rs`
- [Slots popup](https://github.com/md-ruwaid/multi-clip/blob/master/src/index.html): `src/index.html`

### Other components

- **User**
- **System clipboard**
- **Foreground app**

## Connections

- User → Shortcut handler: presses shortcut (evidence: `README.md`)
- User → Tray menu: uses menu (evidence: `src-tauri/src/main.rs`)
- Clipboard watcher → System clipboard: reads text (evidence: `src-tauri/src/main.rs`)
- Clipboard watcher → Slot state: stores copy (evidence: `src-tauri/src/main.rs`)
- Clipboard watcher → Slots popup: notifies slots (evidence: `src-tauri/src/main.rs`)
- Shortcut handler → Paste slot: dispatches paste (evidence: `src-tauri/src/main.rs`)
- Shortcut handler → Clipboard watcher: toggles capture (evidence: `src-tauri/src/main.rs`)
- Shortcut handler → Slot state: clears slots (evidence: `src-tauri/src/main.rs`)
- Paste slot → Slot state: reads slot (evidence: `src-tauri/src/main.rs`)
- Paste slot → System clipboard: sets and restores (evidence: `src-tauri/src/main.rs`)
- Paste slot → Foreground app: types paste (evidence: `src-tauri/src/main.rs`)
- Tray menu → Clipboard watcher: toggles capture (evidence: `src-tauri/src/main.rs`)
- Tray menu → Slot state: clears slots (evidence: `src-tauri/src/main.rs`)
- Tray menu → Slots popup: shows popup (evidence: `src-tauri/src/main.rs`)
- State command → Slot state: returns snapshot (evidence: `src-tauri/src/main.rs`)
- Clipboard watcher → Slots popup: shows popup (evidence: `src-tauri/src/main.rs`)
