Notepad calculator for Linux

Babbage

Type a line, get the answer beside it. A notepad that does the math.

Babbage is a precision-first notepad calculator. Write sums in plain language with numbers, units, money and dates, and the answer appears next to each line as you type. Results stay exact until they can’t, say so when they aren’t, and every sheet is a plain text file you own.

A sheet

A sheet is a list of lines. Names you define turn green, amounts pick up their own colors, and the answers sit in a column on the right.

The Babbage window with a sheet titled Road trip to Wally World. A distance and a speed give the drive time, marked as rounded; a fuel economy gives the gallons and the gas bill at a price per gallon; motels, food, an 18 percent snack allowance and tickets add up to a total and a share for each of five people; below a comment line are 47 repeats of three minutes in hours and a date four days on. The answers are in a column on the right.
A family road trip: a drive time, the gas it burns, a budget with a percentage and a total, a time span and a date. The ≈ marks an answer that is rounded.

What it does

Everything here works today.

Installed in one line

The installer downloads the latest release and checks every file against its published SHA-256 before anything is installed. The program goes under ~/.local, with two commands beside it: babbage opens the window, and bbg answers from the command line. It also adds a launcher entry with an icon and tab completion for bbg. No root needed.

$ curl -fsSL https://github.com/jrimmer/babbage/releases/latest/download/install.sh | bash

# then, from anywhere
$ bbg 20% of 85                  # 17
$ bbg 150 lb in kg              # 68.0388555 kg
$ bbg budget.bbg                # a sheet file: every line answered
$ echo "3 * \$4.50" | bbg       # standard input is a sheet too

Run the same line again to update. Add --uninstall after bash -s -- to remove it. Prefer to download by hand? The release page has the AppImage and a tarball, each with a .sha256 file; check one with sha256sum -c and run it. To build from source, clone the repository and run cargo build --release.

Your sheets are text files

Each sheet is one plain .bbg file in your data folder (~/.local/share/babbage by default), saved as you type. Open it in any editor, back it up with the tools you already use, or move it with mv.

# a sheet is the lines you typed
$ cat ~/.local/share/babbage/Weekend\ trip.bbg
# Weekend trip
flights = $412 × 2
hotel = 3 × $138
…

A line’s own formatting from the … menu is kept at the end of the file and follows the line’s text, so editing a sheet elsewhere does not scramble it.

Updates, and what leaves your computer

Babbage works offline, and the only thing it can do online is look for a newer version of itself. When it starts, at most once a week, it asks the release page for its list of releases. That request carries your IP address and nothing from your sheets or settings. If a newer version exists, an Update pill appears with the release notes and Install, Later and Skip buttons; nothing is downloaded until you press Install, and the file is checked against its published SHA-256 first.

Choose Off, Monthly, Weekly or Daily in Settings, or set BABBAGE_UPDATES=off and Babbage never goes online. The full list of what it asks, sends and keeps is in docs/updates.md.

The engine, as a Rust crate

The calculation engine is a separate crate, babbage-core, with no interface of its own. Hand it a line and it hands back an exact value and how to show it.

$ cargo add babbage-core

// in your program
use babbage_core::{evaluate, format_value, FormatOptions};

let value = evaluate("20% of 85")?;
let shown = format_value(&value, &FormatOptions::default());
assert_eq!(shown.text, "17");

The developer guide covers values, formatting, sheets, settings and what 1.x promises.

Read more