# mlohajner/cfb architecture

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

- Interactive diagram: https://gitdiagram.com/mlohajner/cfb
- Repository: https://github.com/mlohajner/cfb

## Overview

CFB bridges terminal file commands and graphical file managers through the system clipboard. The documented workflow covers terminal copy/cut, then paste into a file manager, and the reverse: file-manager copy/cut followed by terminal paste. The README also documents automatic X11/Wayland selection and filesystem copy/move behavior. No source excerpts were provided, so links between command scripts and the shared library are unverified; those are shown as dashed.

Main entry points: [`bin/cfb-paste`](https://github.com/mlohajner/cfb/blob/main/bin/cfb-paste) (Paste command), [`bin/cfb-copy`](https://github.com/mlohajner/cfb/blob/main/bin/cfb-copy) (Copy command), [`bin/cfb-cut`](https://github.com/mlohajner/cfb/blob/main/bin/cfb-cut) (Cut command), [`lib/cfb-library.sh`](https://github.com/mlohajner/cfb/blob/main/lib/cfb-library.sh) (Clipboard library)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Terminal commands"]
  node_copy["Copy command"]
  node_cut["Cut command"]
  node_paste["Paste command"]
end

subgraph group_bridge["Clipboard bridge"]
  node_library["Clipboard library<br/>[cfb-library.sh]"]
end

subgraph group_destinations["External endpoints"]
  node_clipboard[("System clipboard")]
  node_filemanager["File manager"]
  node_filesystem[("Local filesystem")]
  node_clipboardtools["xclip / wl-clipboard"]
end

node_terminal(("Terminal user"))

node_terminal -->|"runs copy"| node_copy
node_terminal -->|"runs cut"| node_cut
node_terminal -->|"runs paste"| node_paste
node_copy -->|"writes file list"| node_clipboard
node_cut -->|"writes file list"| node_clipboard
node_filemanager -->|"reads selection"| node_clipboard
node_filemanager -->|"writes selection"| node_clipboard
node_paste -->|"reads file list"| node_clipboard
node_paste -->|"copies or moves"| node_filesystem
node_clipboardtools -->|"accesses clipboard"| node_clipboard
node_copy -.->|"may delegate"| node_library
node_cut -.->|"may delegate"| node_library
node_paste -.->|"may delegate"| node_library

click node_copy "https://github.com/mlohajner/cfb/blob/main/bin/cfb-copy"
click node_cut "https://github.com/mlohajner/cfb/blob/main/bin/cfb-cut"
click node_paste "https://github.com/mlohajner/cfb/blob/main/bin/cfb-paste"
click node_library "https://github.com/mlohajner/cfb/blob/main/lib/cfb-library.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_copy,node_cut,node_paste,node_terminal toneBlue
class node_library toneAmber
class node_clipboard,node_filemanager,node_filesystem,node_clipboardtools toneMint
```

## Components

### Terminal commands

- [Copy command](https://github.com/mlohajner/cfb/blob/main/bin/cfb-copy): `bin/cfb-copy`
- [Cut command](https://github.com/mlohajner/cfb/blob/main/bin/cfb-cut): `bin/cfb-cut`
- [Paste command](https://github.com/mlohajner/cfb/blob/main/bin/cfb-paste): `bin/cfb-paste`

### Clipboard bridge

- [Clipboard library](https://github.com/mlohajner/cfb/blob/main/lib/cfb-library.sh): `lib/cfb-library.sh`

### External endpoints

- **System clipboard**
- **File manager**
- **Local filesystem**
- **xclip / wl-clipboard**

### Other components

- **Terminal user**

## Connections

- Terminal user → Copy command: runs copy (evidence: `README.md`)
- Terminal user → Cut command: runs cut (evidence: `README.md`)
- Terminal user → Paste command: runs paste (evidence: `README.md`)
- Copy command → System clipboard: writes file list (evidence: `README.md`)
- Cut command → System clipboard: writes file list (evidence: `README.md`)
- File manager → System clipboard: reads selection (evidence: `README.md`)
- File manager → System clipboard: writes selection (evidence: `README.md`)
- Paste command → System clipboard: reads file list (evidence: `README.md`)
- Paste command → Local filesystem: copies or moves (evidence: `README.md`)
- xclip / wl-clipboard → System clipboard: accesses clipboard (evidence: `README.md`)
- Copy command → Clipboard library: may delegate
- Cut command → Clipboard library: may delegate
- Paste command → Clipboard library: may delegate
