# ngxx-fus/xclipboardcapture architecture

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

- Interactive diagram: https://gitdiagram.com/ngxx-fus/xclipboardcapture
- Repository: https://github.com/ngxx-fus/xclipboardcapture

## Overview

XClipboardCapture is an X11 clipboard-history manager: it captures clipboard changes into local history and exposes that history through a Rofi picker so a chosen item can be restored to the clipboard. The README documents text and image files in the history and a temporary Rofi menu file. The sampled source confirms the X11 transfer, file/list access, and application-loop responsibilities; some menu-selection and initialization wiring is unsampled, so those links are omitted where not established.

Main entry points: [`ClipboardCapture.c`](https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c) (Capture lifecycle), [`xClipBoardCapture.c`](https://github.com/ngxx-fus/xclipboardcapture/blob/release/xClipBoardCapture.c) (Application loop), [`CBC_SysFile.c`](https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_SysFile.c) (History list), [`CBC_Setup.h`](https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_Setup.h) (Runtime configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application control"]
  node_main["Application loop"]
  node_lifecycle["Capture lifecycle<br/>[ClipboardCapture.c]"]
  node_config["Runtime configuration<br/>[CBC_Setup.h]"]
end

subgraph group_clipboard["Clipboard transfer"]
  node_runtime["X11 runtime<br/>[ClipboardCapture.c]"]
  node_capture["Capture and serve<br/>[ClipboardCapture.c]"]
end

subgraph group_history["History and storage"]
  node_historylist["History list<br/>[CBC_SysFile.c]"]
  node_files[("Clipboard files<br/>[CBC_SysFile.c]")]
end

subgraph group_ui["Picker interface"]
  node_menu["Rofi menu<br/>[ClipboardCapture.c]"]
  node_menufile["Menu handoff file<br/>[CBC_Setup.h]"]
end

subgraph group_support["Shared utilities"]
  node_logging["Logging<br/>[xUniversal.c]"]
end

node_user(("User"))
node_signal(("POSIX signals"))
node_xserver["X server"]
node_rofi["Rofi"]

node_user -.->|"requests picker"| node_signal
node_signal -.->|"sets popup flag"| node_main
node_main -->|"initializes"| node_lifecycle
node_main -->|"opens picker"| node_menu
node_lifecycle -->|"reads settings"| node_config
node_lifecycle -->|"starts runtime"| node_runtime
node_runtime -->|"exchanges events and data"| node_xserver
node_runtime -->|"handles transfers"| node_capture
node_capture -->|"writes captured data"| node_files
node_runtime -->|"reads selected item"| node_historylist
node_historylist -->|"reads and manages files"| node_files
node_menu -->|"reads history"| node_historylist
node_menu -->|"writes menu entries"| node_menufile
node_menu -->|"launches picker"| node_rofi
node_lifecycle -->|"logs status"| node_logging

click node_main "https://github.com/ngxx-fus/xclipboardcapture/blob/release/xClipBoardCapture.c"
click node_lifecycle "https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c"
click node_runtime "https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c"
click node_capture "https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c"
click node_historylist "https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_SysFile.c"
click node_files "https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_SysFile.c"
click node_config "https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_Setup.h"
click node_menu "https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c"
click node_menufile "https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_Setup.h"
click node_logging "https://github.com/ngxx-fus/xclipboardcapture/blob/release/xUniversal/xUniversal.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_main,node_lifecycle,node_config,node_user toneBlue
class node_runtime,node_capture toneAmber
class node_historylist,node_files,node_xserver toneMint
class node_menu,node_menufile toneRose
class node_logging,node_signal,node_rofi toneIndigo
```

## Components

### Application control

- [Application loop](https://github.com/ngxx-fus/xclipboardcapture/blob/release/xClipBoardCapture.c): `xClipBoardCapture.c`
- [Capture lifecycle](https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c): `ClipboardCapture.c`
- [Runtime configuration](https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_Setup.h): `CBC_Setup.h`

### Clipboard transfer

- [X11 runtime](https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c): `ClipboardCapture.c`
- [Capture and serve](https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c): `ClipboardCapture.c`

### History and storage

- [History list](https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_SysFile.c): `CBC_SysFile.c`
- [Clipboard files](https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_SysFile.c): `CBC_SysFile.c`

### Picker interface

- [Rofi menu](https://github.com/ngxx-fus/xclipboardcapture/blob/release/ClipboardCapture.c): `ClipboardCapture.c`
- [Menu handoff file](https://github.com/ngxx-fus/xclipboardcapture/blob/release/CBC_Setup.h): `CBC_Setup.h`

### Shared utilities

- [Logging](https://github.com/ngxx-fus/xclipboardcapture/blob/release/xUniversal/xUniversal.c): `xUniversal/xUniversal.c`

### Other components

- **User**
- **POSIX signals**
- **X server**
- **Rofi**

## Connections

- User → POSIX signals: requests picker
- POSIX signals → Application loop: sets popup flag
- Application loop → Capture lifecycle: initializes
- Application loop → Rofi menu: opens picker
- Capture lifecycle → Runtime configuration: reads settings
- Capture lifecycle → X11 runtime: starts runtime
- X11 runtime → X server: exchanges events and data
- X11 runtime → Capture and serve: handles transfers
- Capture and serve → Clipboard files: writes captured data
- X11 runtime → History list: reads selected item
- History list → Clipboard files: reads and manages files
- Rofi menu → History list: reads history
- Rofi menu → Menu handoff file: writes menu entries
- Rofi menu → Rofi: launches picker
- Capture lifecycle → Logging: logs status
