8000 GitHub - evindor/calpad: You new favourite calculator · GitHub
[go: up one dir, main page]

Skip to content
evindorPublic

About

You new favourite calculator

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

Calpad icon

Calpad

A natural language calculator notepad. Type math, units, currencies, percentages and dates in plain text and watch the answers appear next to each line.

Try it in the browser · Download · Features · Install

CI Release License

Calpad desktop app

Calpad is inspired by Numi. It is one Rust engine with three frontends that share the same syntax, the same notes format, and the same results:

Frontend What it is Runs on
Desktop app GTK4 + libadwaita, follows your system theme and fonts Linux
Terminal app Full-screen TUI with sidebar, themes and live results Linux, macOS, Windows
Web app / PWA Same engine compiled to WebAssembly, notes stored in your browser Any browser
Keystroke extension Quick sessions inside the Keystroke command palette on Omarchy; Ctrl+O continues the note in the desktop app Omarchy

The engine is also a plain Rust library (calpad-core) and a single-shot CLI (calpad "5 kg in pounds").

Features

Everything below is live: results update on every keystroke, and each line can refer to the ones above it.

Arithmetic and formats

2 ^ 8                    256
15 mod 4                 3
6(3)                     18
0xFF + 0b1010            265
255 in hex               0xFF
5300 in sci              5.3e3
sqrt(144)  fact(6)  ln(e)  sin(pi / 6)  round(3.7)

Variables, labels, and cross-line references

price = 49.99
qty = 3
price * qty              149.97

Rent: $1,800
Utilities: $140
Groceries: $450
sum                      $2,390

prev * 12                the previous result, times 12

Blank lines reset sum and average, so you can group calculations. Lines starting with # are headers, // are comments.

Units (100+ definitions with automatic conversion in arithmetic)

5 feet 10 inches in cm   177.8 cm
11 stone 5 lbs in kg     72.12115 kg
98.6 fahrenheit in celsius   37 °C
4.2 MB * 847 in GB       3.5574 GB
1 GiB in MB              1,073.741824 MB
3.5 hours in minutes     210 min
2400 square feet in square meters   222.9672 sq m
16px in pt               12 pt
180 degrees in radians   3.1415926536 rad

Percentages and scales

30% of $120              $36
$120 - 30%               $84
$47.50 + 20%             $57
signups as a % of visitors   4%
8% of what is 200        2,500
revenue = $4.2M
burn = $420k
runway = $12M / burn     28.5714285714

Currencies (26 fiat currencies, live rates from frankfurter.app, cached offline)

$100 in EUR
hotel = €89 * 7
hotel in USD
$500 + €200
¥10000 in USD

Dates and time

now
now + 90 days
now - 2 weeks
fromunix(1446587186)
now + 6 months

The full tour ships inside every app as the Calpad Guide note.

The apps

Desktop (GTK4 + libadwaita)

Calpad desktop app showing the guide note

  • Native libadwaita chrome: follows the system dark/light preference, fonts, and window styling.
  • Results column aligned to each line. Click a result to copy it.
  • Notes sidebar with autosave, undo/redo, and a delete confirmation.
  • On Omarchy, syntax colors are read from the active Omarchy theme and update live when you switch themes. Elsewhere they fall back to the GNOME palette.
  • Shortcuts: Ctrl+N new note, Ctrl+B toggle sidebar, Ctrl+? shortcuts, Ctrl+Q quit.

Terminal (TUI)

Calpad terminal app

  • calpad tui opens a full-screen editor with a notes sidebar and live results.
  • Eight built-in themes (Ctrl+T to cycle): monokai, dracula, nord, one-dark, catppuccin, gruvbox, solarized-dark, solarized-light.
  • Shares its notes, config, and rate cache with the desktop app in ~/.local/share/calpad/.
  • calpad "5 kg in pounds" evaluates a single expression; piping a document to stdin evaluates every line.

Web / PWA

Calpad web app

  • Hosted at evindor.github.io/calpad. No account, no server: notes live in your browser's IndexedDB.
  • Share a note as a link (the content is encoded in the URL fragment).
  • Same eight themes as the TUI, syntax highlighting, keyboard shortcuts.

Keystroke extension (Omarchy)

A quick Calpad session inside the Keystroke command palette

  • Type something Calpad understands at the palette root (price = 10, $120 - 30%, now + 90 days) and pick Quick Calpad session: a live note opens inside the palette, results to the right of each line.
  • ↵ copies the result of the current line, ⇧↵ adds a line, Ctrl+O opens the same note in the desktop app, recent sessions are one keystroke away.
  • Evaluation runs through the calpad CLI (calpad --json), so the three apps and the palette agree to the digit. Lives in keystroke/; installed from evindor/keystroke-calpad.

Install

Desktop app (Linux)

Download calpad-gtk-linux-x86_64.tar.gz from the latest release, then:

tar xzf calpad-gtk-linux-x86_64.tar.gz
cd calpad-gtk-linux-x86_64
./install.sh        # copies the binary, .desktop entry and icon into ~/.local

Requires GTK 4 and libadwaita 1.8 or newer at runtime (Arch, Fedora 43+, Ubuntu 26.04+, or any distro with a current GNOME stack). On Omarchy both are already installed.

Or build from source, which works on any distro with the gtk4 and libadwaita development packages:

git clone https://github.com/evindor/calpad
cd calpad/core/calpad-gtk
./install.sh

CLI / TUI

Prebuilt binaries for Linux (x86_64, aarch64), macOS (Apple Silicon) and Windows are on the releases page. Rename the file to calpad and put it on your PATH.

With a Rust toolchain:

cargo install --git https://github.com/evindor/calpad calpad-cli

Keystroke extension (Omarchy)

With the CLI on your PATH, in Keystroke type ext, open Extensions and pick Calpad, or:

omarchy plugin add https://github.com/evindor/keystroke-calpad.git --enable

Build from source

# Engine, CLI and tests
cd core
cargo test --workspace --exclude calpad-gtk
cargo build --release -p calpad-cli

# Keystroke extension (Omarchy): unit tests, manifest validation, offscreen check
keystroke/bin/test

# Desktop app (needs gtk4 + libadwaita dev packages)
cargo run --release -p calpad-gtk

# Web app (needs wasm-pack and bun)
rustup target add wasm32-unknown-unknown
cargo install wasm-pack
wasm-pack build calpad-wasm --target web --out-dir ../../web/src/lib/engine/pkg
cd ../web && bun install && bun run dev

Architecture

core/
├── calpad-core/     # Parser (winnow) + evaluator + unit system. No I/O, no deps on any frontend.
├── calpad-common/   # Note storage, currency rates, tokenizer shared by the native apps
├── calpad-cli/      # `calpad` binary: one-shot evaluation, stdin, and the ratatui TUI
├── calpad-gtk/      # Desktop app (gtk4-rs + libadwaita)
└── calpad-wasm/     # wasm-bindgen wrapper for the web app
web/                 # SvelteKit + Vite frontend, deployed to GitHub Pages
keystroke/           # Keystroke (Omarchy) extension: QML over the CLI, published as evindor/keystroke-calpad

Every frontend sends the whole document to the engine and gets back one result per line, so behavior is identical everywhere.

License

MIT

About

You new favourite calculator

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0