# gakuseei/rishot architecture

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

- Interactive diagram: https://gitdiagram.com/gakuseei/rishot
- Repository: https://github.com/gakuseei/rishot

## Overview

rishot is a Wayland screenshot-and-annotation application built on Quickshell. The main workflow is to launch it, capture a region/window/monitor, annotate the image, then copy, save, or upload it; CLI modes can instead copy, emit, or extract text and codes without opening the editor. The README documents these capabilities, but only the library modules were excerpted, so UI and capture links below rely on README statements where noted; uncertain implementation-level connections are omitted.

Main entry points: [`src/shell.qml`](https://github.com/gakuseei/rishot/blob/main/src/shell.qml) (App shell), [`src/Overlay.qml`](https://github.com/gakuseei/rishot/blob/main/src/Overlay.qml) (Selection overlay), [`src/Toolbar.qml`](https://github.com/gakuseei/rishot/blob/main/src/Toolbar.qml) (Annotation toolbar), [`src/SettingsPanel.qml`](https://github.com/gakuseei/rishot/blob/main/src/SettingsPanel.qml) (Settings panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and selection"]
  node_launcher["CLI launcher"]
  node_shell["App shell<br/>[shell.qml]"]
  node_capture_flow["Capture modes<br/>[shell.qml]"]
  node_window_provider["Window providers<br/>[providers.js]"]
  node_overlay["Selection overlay<br/>[Overlay.qml]"]
end

subgraph group_editor["Annotation editor"]
  node_toolbar["Annotation toolbar<br/>[Toolbar.qml]"]
  node_annotation_model["Annotation history<br/>[AnnotationModel.js]"]
  node_hit_test["Annotation hit testing<br/>[hittest.js]"]
  node_coordinates["Selection geometry<br/>[coords.js]"]
end

subgraph group_actions["Output and settings"]
  node_settings["Settings panel<br/>[SettingsPanel.qml]"]
  node_config["Configuration<br/>[Config.qml]"]
  node_save_copy_upload["Save copy upload<br/>[shell.qml]"]
  node_ocr_codes["OCR and code scan<br/>[shell.qml]"]
end

subgraph group_shared["Shared runtime logic"]
  node_translation["Locale lookup<br/>[i18n.js]"]
  node_key_binding["Key binding logic<br/>[keymap.js]"]
end

node_user(("User"))
node_window_provider_data["Compositor window data"]
node_compositor(("Wayland compositor"))
node_capture_backend["Capture backend"]
node_clipboard["System clipboard"]
node_save_target[("File destination")]
node_upload_service["Upload endpoint"]
node_ocr_tools["OCR and barcode tools"]

node_user -->|"launches"| node_launcher
node_launcher -->|"starts"| node_shell
node_shell -->|"orchestrates"| node_capture_flow
node_capture_flow -->|"queries windows"| node_compositor
node_capture_flow -.->|"parses window data"| node_window_provider
node_window_provider -->|"parses"| node_window_provider_data
node_capture_flow -->|"captures image"| node_capture_backend
node_capture_flow -->|"opens editor"| node_overlay
node_user -->|"selects area"| node_overlay
node_overlay -.->|"uses geometry"| node_coordinates
node_overlay -.->|"shows tools"| node_toolbar
node_toolbar -.->|"edits annotations"| node_annotation_model
node_toolbar -.->|"selects annotations"| node_hit_test
node_user -->|"configures"| node_settings
node_settings -->|"writes settings"| node_config
node_shell -->|"handles output"| node_save_copy_upload
node_save_copy_upload -->|"copies image"| node_clipboard
node_save_copy_upload -->|"saves image"| node_save_target
node_save_copy_upload -->|"uploads image"| node_upload_service
node_shell -->|"runs extraction"| node_ocr_codes
node_ocr_codes -->|"invokes tools"| node_ocr_tools
node_ocr_codes -->|"copies results"| node_clipboard
node_shell -.->|"resolves messages"| node_translation
node_settings -.->|"formats bindings"| node_key_binding

click node_launcher "https://github.com/gakuseei/rishot/blob/main/bin/rishot"
click node_shell "https://github.com/gakuseei/rishot/blob/main/src/shell.qml"
click node_capture_flow "https://github.com/gakuseei/rishot/blob/main/src/shell.qml"
click node_window_provider "https://github.com/gakuseei/rishot/blob/main/src/lib/providers.js"
click node_overlay "https://github.com/gakuseei/rishot/blob/main/src/Overlay.qml"
click node_toolbar "https://github.com/gakuseei/rishot/blob/main/src/Toolbar.qml"
click node_annotation_model "https://github.com/gakuseei/rishot/blob/main/src/lib/AnnotationModel.js"
click node_hit_test "https://github.com/gakuseei/rishot/blob/main/src/lib/hittest.js"
click node_coordinates "https://github.com/gakuseei/rishot/blob/main/src/lib/coords.js"
click node_settings "https://github.com/gakuseei/rishot/blob/main/src/SettingsPanel.qml"
click node_config "https://github.com/gakuseei/rishot/blob/main/src/Singletons/Config.qml"
click node_save_copy_upload "https://github.com/gakuseei/rishot/blob/main/src/shell.qml"
click node_ocr_codes "https://github.com/gakuseei/rishot/blob/main/src/shell.qml"
click node_translation "https://github.com/gakuseei/rishot/blob/main/src/lib/i18n.js"
click node_key_binding "https://github.com/gakuseei/rishot/blob/main/src/lib/keymap.js"

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_launcher,node_shell,node_capture_flow,node_window_provider,node_overlay,node_user toneBlue
class node_toolbar,node_annotation_model,node_hit_test,node_coordinates,node_save_target toneAmber
class node_settings,node_config,node_save_copy_upload,node_ocr_codes toneMint
class node_translation,node_key_binding toneRose
class node_window_provider_data,node_compositor,node_capture_backend,node_clipboard,node_upload_service,node_ocr_tools toneIndigo
```

## Components

### Capture and selection

- [CLI launcher](https://github.com/gakuseei/rishot/blob/main/bin/rishot): `bin/rishot`
- [App shell](https://github.com/gakuseei/rishot/blob/main/src/shell.qml): `src/shell.qml`
- [Capture modes](https://github.com/gakuseei/rishot/blob/main/src/shell.qml): `src/shell.qml`
- [Window providers](https://github.com/gakuseei/rishot/blob/main/src/lib/providers.js): `src/lib/providers.js`
- [Selection overlay](https://github.com/gakuseei/rishot/blob/main/src/Overlay.qml): `src/Overlay.qml`

### Annotation editor

- [Annotation toolbar](https://github.com/gakuseei/rishot/blob/main/src/Toolbar.qml): `src/Toolbar.qml`
- [Annotation history](https://github.com/gakuseei/rishot/blob/main/src/lib/AnnotationModel.js): `src/lib/AnnotationModel.js`
- [Annotation hit testing](https://github.com/gakuseei/rishot/blob/main/src/lib/hittest.js): `src/lib/hittest.js`
- [Selection geometry](https://github.com/gakuseei/rishot/blob/main/src/lib/coords.js): `src/lib/coords.js`

### Output and settings

- [Settings panel](https://github.com/gakuseei/rishot/blob/main/src/SettingsPanel.qml): `src/SettingsPanel.qml`
- [Configuration](https://github.com/gakuseei/rishot/blob/main/src/Singletons/Config.qml): `src/Singletons/Config.qml`
- [Save copy upload](https://github.com/gakuseei/rishot/blob/main/src/shell.qml): `src/shell.qml`
- [OCR and code scan](https://github.com/gakuseei/rishot/blob/main/src/shell.qml): `src/shell.qml`

### Shared runtime logic

- [Locale lookup](https://github.com/gakuseei/rishot/blob/main/src/lib/i18n.js): `src/lib/i18n.js`
- [Key binding logic](https://github.com/gakuseei/rishot/blob/main/src/lib/keymap.js): `src/lib/keymap.js`

### Other components

- **User**
- **Compositor window data**
- **Wayland compositor**
- **Capture backend**
- **System clipboard**
- **File destination**
- **Upload endpoint**
- **OCR and barcode tools**

## Connections

- User → CLI launcher: launches (evidence: `README.md`)
- CLI launcher → App shell: starts (evidence: `README.md`)
- App shell → Capture modes: orchestrates (evidence: `README.md`)
- Capture modes → Wayland compositor: queries windows (evidence: `README.md`)
- Capture modes → Window providers: parses window data
- Window providers → Compositor window data: parses (evidence: `src/lib/providers.js`)
- Capture modes → Capture backend: captures image (evidence: `README.md`)
- Capture modes → Selection overlay: opens editor (evidence: `README.md`)
- User → Selection overlay: selects area (evidence: `README.md`)
- Selection overlay → Selection geometry: uses geometry
- Selection overlay → Annotation toolbar: shows tools
- Annotation toolbar → Annotation history: edits annotations
- Annotation toolbar → Annotation hit testing: selects annotations
- User → Settings panel: configures (evidence: `README.md`)
- Settings panel → Configuration: writes settings (evidence: `README.md`)
- App shell → Save copy upload: handles output (evidence: `README.md`)
- Save copy upload → System clipboard: copies image (evidence: `README.md`)
- Save copy upload → File destination: saves image (evidence: `README.md`)
- Save copy upload → Upload endpoint: uploads image (evidence: `README.md`)
- App shell → OCR and code scan: runs extraction (evidence: `README.md`)
- OCR and code scan → OCR and barcode tools: invokes tools (evidence: `README.md`)
- OCR and code scan → System clipboard: copies results (evidence: `README.md`)
- App shell → Locale lookup: resolves messages
- Settings panel → Key binding logic: formats bindings
