# canclini/omarchy-calculator architecture

> Architecture diagram of the GitHub repository canclini/omarchy-calculator, 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/canclini/omarchy-calculator
- Repository: https://github.com/canclini/omarchy-calculator
- Video tour (about a minute): https://gitdiagram.com/canclini/omarchy-calculator/video

## Overview

Omarchy Calculator is a shell calculator plugin: users open its overlay from the bar or an optional keyboard/menu action, edit an expression with live feedback, then copy a completed result and close. The UI and safe expression evaluator are the main internal layers; the evaluator normalizes, parses, and formats calculations. README capabilities include local notation, functions, percent semantics, and paired-parenthesis editing. QML source was not sampled, so UI-to-model and clipboard links reflect documented behavior rather than inspected call sites.

Main entry points: [`Calculator.qml`](https://github.com/canclini/omarchy-calculator/blob/main/Calculator.qml) (Calculator overlay), [`BarWidget.qml`](https://github.com/canclini/omarchy-calculator/blob/main/BarWidget.qml) (Bar icon), [`CalcModel.js`](https://github.com/canclini/omarchy-calculator/blob/main/CalcModel.js) (Expression evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Plugin interface"]
  node_bar["Bar icon<br/>[BarWidget.qml]"]
  node_overlay["Calculator overlay<br/>[Calculator.qml]"]
  node_editing["Expression editing<br/>[Calculator.qml]"]
end

subgraph group_calculation["Calculation"]
  node_evaluator["Expression evaluator<br/>[CalcModel.js]"]
end

subgraph group_system["Shell integration"]
  node_shell["Omarchy shell"]
  node_clipboard["System clipboard"]
end

node_user(("User"))
node_keyboard(("Keyboard binding"))

node_user -->|"clicks"| node_bar
node_bar -->|"opens plugin"| node_shell
node_keyboard -.->|"toggles plugin"| node_shell
node_shell -->|"shows"| node_overlay
node_user -->|"types and edits"| node_editing
node_editing -->|"evaluates expression"| node_evaluator
node_evaluator -->|"returns result"| node_overlay
node_user -->|"presses Enter"| node_overlay
node_overlay -->|"copies result"| node_clipboard
node_overlay -->|"closes"| node_shell

click node_bar "https://github.com/canclini/omarchy-calculator/blob/main/BarWidget.qml"
click node_overlay "https://github.com/canclini/omarchy-calculator/blob/main/Calculator.qml"
click node_editing "https://github.com/canclini/omarchy-calculator/blob/main/Calculator.qml"
click node_evaluator "https://github.com/canclini/omarchy-calculator/blob/main/CalcModel.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_bar,node_overlay,node_editing,node_user toneBlue
class node_evaluator toneAmber
class node_shell,node_clipboard toneMint
class node_keyboard toneIndigo
```

## Components

### Plugin interface

- [Bar icon](https://github.com/canclini/omarchy-calculator/blob/main/BarWidget.qml): `BarWidget.qml`
- [Calculator overlay](https://github.com/canclini/omarchy-calculator/blob/main/Calculator.qml): `Calculator.qml`
- [Expression editing](https://github.com/canclini/omarchy-calculator/blob/main/Calculator.qml): `Calculator.qml`

### Calculation

- [Expression evaluator](https://github.com/canclini/omarchy-calculator/blob/main/CalcModel.js): `CalcModel.js`

### Shell integration

- **Omarchy shell**
- **System clipboard**

### Other components

- **User**
- **Keyboard binding**

## Connections

- User → Bar icon: clicks
- Bar icon → Omarchy shell: opens plugin
- Keyboard binding → Omarchy shell: toggles plugin
- Omarchy shell → Calculator overlay: shows
- User → Expression editing: types and edits
- Expression editing → Expression evaluator: evaluates expression
- Expression evaluator → Calculator overlay: returns result
- User → Calculator overlay: presses Enter
- Calculator overlay → System clipboard: copies result
- Calculator overlay → Omarchy shell: closes
