Skip to content

ALI-2104: Package Alias Calc: install.sh, desktop entry, icons - #13

Merged
michaelaguiar merged 83 commits into
mainfrom
aliasbot/ali-2104-package-alias-calc-for-aliasos
Nov 26, 2026
Merged

michaelaguiar merged 83 commits into
mainfrom
aliasbot/ali-2104-package-alias-calc-for-aliasos

Conversation

@michaelaguiar

@michaelaguiar michaelaguiar commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

This is the alias-calc half of packaging Alias Calc for aliasOS. The PKGBUILD is a draft PR in aliasos-pkgs, and it follows Alias Notes' pattern.

  • install.sh installs four things under PREFIX (default ~/.local; /usr with DESTDIR for the package):

    • the binary;
    • the screen reader library, in lib/alias-calc/;
    • the desktop entry;
    • the icons.

    Each file goes in through a temporary name and a rename, so a running calculator keeps its files. ./install.sh uninstall removes them.

  • Desktop entry: com.aliasproject.calc, shown as "Calculator" in the launcher, under the categories Utility;Calculator. Its keywords add arithmetic and Alias Calc to the ticket's alias-calc;calc;math;, so a launcher search for the product name finds it even though its name is "Calculator". It passes desktop-file-validate cleanly.

  • Size: the screen reader library builds with its own profile, release-a11y (opt-level = "z"), since it's loaded only while Orca runs. That takes it from 2.7 to 1.87 MB, and the installed package from 3.7 to 2.9 MB. The binary keeps the release profile. Setting opt-level on the a11y package alone made it bigger (3.06 MB), because its 78 dependencies stayed at level 3.

  • Library search: the loader now also looks in lib/alias-calc/ beside the binary's bin/, before /usr/lib/alias-calc/, so a ~/.local install finds its own library.

  • Icons: the chosen logo (M2 on the design canvas): the four operators + − × / on the Alias family tile, with an amber corner. There's a 512-unit scalable file, plus 24 px and 16 px files drawn on the pixel grid. The glyph (#f4f4f2) on the tile (#26262a) is 13.7:1, well over WCAG 2.2 AA's 3:1 for graphics.

Check

  • cargo test --workspace: 98 + 3 pass. looks_beside_the_binary_then_under_its_prefix covers the new search order.
  • A staged PREFIX=/usr DESTDIR=… install puts the six files in place, with Exec="/usr/bin/alias-calc".
  • With a ~/.local-style install and a stand-in orca process running, the library loaded from <prefix>/lib/alias-calc/. Uninstall removed everything except the desktop-database caches that update-desktop-database writes.
  • makepkg with the draft PKGBUILD, pointed at this branch's commit (ee13d66), built and packaged the same six files. pacman reports an installed size of 2,859,911 bytes.
  • The size-built library loads and reports ABI 2. Its code is unchanged, only the optimisation level.

After the merge

  1. Create the signed tag v0.1.0 on the merge commit and push it.
  2. Set _commit in the aliasos-pkgs alias-calc PKGBUILD to that commit, and take that PR out of draft.

Linear: ALI-2104

bench/run measures Alias Calc, omacalc and GNOME Calculator the same way
(exec to Hyprland openwindow, PSS/RSS/threads after 2 s, wakeups over 5 idle
seconds) and prints one table of medians. The README records the baselines
the app has to beat.

ALI-2097
One thread blocking in poll on the Wayland socket, with no timeouts, so an
idle window never wakes on its own (Hyprland's 1.5 s ping is the only
wakeup). Pure-Rust Wayland, so the binary links only libc and libgcc_s.
Sharp at fractional scales via fractional-scale-v1 + viewporter, falling
back to integer buffer scales. Window title Calculator, app ID
com.aliasproject.calc. ALIAS_CALC_TRACE=1 prints startup timings.

bench/run floats all three apps first, as they are in daily use.

ALI-2098
Keys in, expression and display text out, with no UI. It follows omacalc's
rules (precedence with ^ first and right to left, desk-calculator percent,
chaining from the exact result, sign, backspace, paste, thousands
separators), but numbers are exact decimals (rust_decimal), so 0.1 + 0.2
is 0.3 and 16-digit integers show exactly. Values past a decimal's range
(about 7.9e28, or below 1e-28) fall back to f64, so 10 ^ 308 still works.

Nothing calls it until the keypad lands (ALI-2101).

ALI-2100
A small CPU renderer: solid fills, anti-aliased rounded rectangles (exact
coverage on the edges and corners, solid spans everywhere else) and text
from 9 KB subsets of JetBrains Mono Regular and Light, rasterized with
fontdue and cached per face, character and size. No fontconfig lookup.

ui.rs lays out the expression line, the result (shrunk to fit) and the
5x4 keypad in logical pixels, drawn at the buffer's scale. Key corners
are 4 px, close to the 2 px aliasOS windows use. The palette is worked out
from a background, foreground and accent; a fixed one stands in until the
theme lands (ALI-2103).

A full frame is 0.54 ms at 640x960 (4K at scale 2), checked by an ignored
budget test: cargo test --release -- --ignored budget.

ALI-2099
Keys map by keysym, so the layout is followed and the numpad works with
NumLock on or off. Ctrl, Alt and Super chords are left alone (copy and
paste come in ALI-2102). A button lights while its keyboard key is held,
and while the mouse holds it; a click counts only if it ends on the button
it began on. Backspace repeats at the compositor's rate, timed by the poll
timeout, which is set only while it's held, so idle still never wakes.
The pointer gets the default cursor through cursor-shape-v1.

The engine (ALI-2100) is merged in; the display shows its expression and
result.

ALI-2101
Reads background, foreground and accent (falling back to color4, then the
foreground) from current/theme/colors.toml with a small line parser, and
works the key, pressed, muted and on-accent colors out from them. An
inotify watch on current/ sees aliasos-theme-apply's mv of theme (the
event aliasos-theme-changed waits on) and Omarchy's theme symlink swap;
the window redraws once with the new colors. The watch's fd sits in the
same poll as the Wayland socket, so it adds no wakeups.

Order: $XDG_STATE_HOME/aliasos/current, then $XDG_CONFIG_HOME/omarchy/current,
then the built-in dark palette.

ALI-2103
The compositor sends the keymap along with the first configure, and
compiling it in libxkbcommon took ~1.5 ms ahead of the first draw. The
keyboard is now bound right after the first commit: first frame at 1.1 ms
instead of 3.0 ms.

ALI-2101
…ut' into aliasbot/ali-2103-follow-the-live-aliasos-theme
Binding the keyboard in the same flush as the first commit still delayed
the map: Hyprland builds the keymap it sends a new keyboard before it gets
to the rest of the batch. The first frame now goes out on its own, then the
keyboard and the pointer are bound. Map time (exec to openwindow, median of
10) is 2.7 ms, against 2.5 ms for a window with no input at all.

ALI-2101
…ut' into aliasbot/ali-2103-follow-the-live-aliasos-theme
Ctrl+C or Super+C offers the result without separators (an error isn't
copied) as text/plain;charset=utf-8, text/plain, UTF8_STRING, TEXT and
STRING. Ctrl+V or Super+V reads the selection in the best of those and
pastes it if it's a number, with or without separators.

The paste pipe is read without blocking, from the same poll as the Wayland
socket: the source can be this app, which has to answer its own
send_request while the paste is still being read. Pastes over 256 bytes or
not UTF-8 are dropped.

The data device shares the keyboard's seat and is made with it, after the
first frame.

ALI-2102
From review: a crashed app read as 0 MB and no wakeups; the map timeout
restarted on every unrelated Hyprland event; the class was matched anywhere
in the openwindow line (a title containing "omacalc" counted); wakeups
summed counters over whichever threads existed at each sample; an app
ignoring SIGTERM hung the run.

Now the class field is matched exactly, the deadline is checked on every
event, the run fails if the app exits before or after mapping, wakeups are
per-thread differences, and the app is SIGKILLed if SIGTERM doesn't end it.
bench/run finds the binary through cargo metadata, parses --runs N and
--runs=N (rejecting anything else), and exits 1 when no app was measured.
The README and CI no longer say the app links libwayland: the Wayland client
is pure Rust.

ALI-2097
From review: a failed buffer allocation printed a line and left the app
blocked in poll with no window; a flush that hit a full socket left requests
queued with nothing to wake the loop until the compositor spoke; and a
configure fixing only one axis was treated as no size at all.

draw() now returns an error that ends the app; after a WouldBlock flush the
loop also polls for writable and flushes again; each axis of a configure is
resolved on its own. bench/run (in the merge) now says it added a float
rule.

ALI-2098
From review: glyphs were cached per 1/16 px but measured at the exact
size, and pen advances were fractional, so right-aligned text could end
off the padding and digit spacing wobbled at fractional scales; the
cache grew without bound while resizing a small window (key labels track
the key height); fit() could shrink text to 1 px; hit_test used the
unsnapped key rectangles, so a key's edge pixel at a fractional scale could
miss it; from_hex took "#+1+2+3" and "##ffffff"; dark/light split at
luminance 0.5, so mid-tones counted as dark.

Text sizes and advances are now whole pixels in both measuring and
drawing; the cache empties past 512 glyphs; fit() has a floor (16 px for
the result, which still fits the longest number in the narrowest window;
13 px for the expression, which is then elided from the start with …,
added to the font subsets); drawing and hit_test share key_pixels();
from_hex wants exactly six hex digits; the split is at 0.18. CI runs the
frame budget in release.

ALI-2099
Takes the new hit_test signature (scale, pixel-snapped keys) and draw()'s
error return alongside this branch's deferred input binding and repeat
timeout.
- A decimal keeps 28 places, not 28 significant digits, so a ×, ÷ or ^
  result below 1e-13 is now redone in f64 and keeps 15 digits
  (1 ÷ 300000000000000 showed 14 digits; 0.7 ^ 100 showed 13).
- Every exact result except a division's is rounded to 25 significant
  digits. The guard digits below that absorb a division's last-place
  error, so 1 ÷ 3 × 3 − 1 is exactly 0 instead of -1e-28.
- A fractional power stays an f64 unless it's whole or its 15-digit text
  reads back as the same f64, so 2 ^ 0.5 × 2 ^ 0.5 is 2, not
  2.000000000000014. 4 ^ 0.5 and 9 ^ 0.5 stay exact.
- paste refuses a lone comma at either end (1, or ,5).
- Docs: the module doc covers the f64 cases, and paste's doc says long
  numbers are rounded to 16 digits.

ALI-2100
…e it

From review: SCTK reports a removed seat only through remove_seat, which
did nothing, so a Backspace held while its seat went away kept repeating
and a lit key stayed lit; a compositor switching repeat off mid-hold left
the repeat running at the 40 ms fallback; a socket kept busy (pointer
motion while Backspace is held) kept poll from timing out, delaying the
repeat; tearing down input cleared the lit key without a redraw; the
numpad decimal key on decimal-comma layouts (KP_Separator) and a dead ^
did nothing.

remove_seat and remove_capability now share drop_keyboard/drop_pointer,
which also redraw; RepeatInfo::Disable clears a running repeat; a due
repeat fires at the top of the loop as well as on a poll timeout;
KP_Separator is the decimal point and dead_circumflex is ^.

ALI-2101
Merges the reviewed keypad (ALI-2101) and, from review: an aliasOS current/
with a missing or broken colors.toml went to the built-in palette instead
of Omarchy's; only the first existing source was watched, so a machine
starting on Omarchy's theme never saw aliasOS's arrive; XDG_STATE_HOME was
honoured though aliasos-theme-apply hard-codes ~/.local/state; single
quotes and [tables] weren't handled; the theme was read before the watch
began; a failed reload flashed the built-in colors; an inotify read error
left the fd readable and could spin the loop.

load() now takes the first source whose colors.toml parses and returns
None rather than a default; every existing source's current/ is watched;
paths are fixed under $HOME; single quotes work and parsing stops at the
first [table]; the watch starts before the first read; a reload that finds
nothing keeps the colors showing; a broken watch is dropped. The event loop
owns the watch, and the merge combines it with the repeat timeout and the
writable-socket poll.

ALI-2103
The paste pipe joins the theme watch's event loop as a third poll slot,
and is put back into the app before anything that can continue the loop.
…'s shortcuts

From review: paste dropped every space, so "2026 11 25" and "555 1234" were
taken as numbers, while the no-break spaces locales group digits with were
refused; a second Ctrl+V that couldn't start cancelled a paste still being
read; the data device outlived a removed keyboard; aliasOS's universal
Super+C/V reach some apps as Ctrl+Insert / Shift+Insert, which did nothing.

Spaces (plain, no-break, thin, narrow no-break) are now taken only as
thousands separators in groups of three; a paste that can't start leaves
the pending one alone; dropping the keyboard drops its data device;
Ctrl+Insert copies and Shift+Insert pastes.

ALI-2102
From review round 2: CLOSE_WRITE never matched (a theme arrives as a moved
or created entry named theme) but woke the loop for the theme.name and
theme.generation writes on every switch; an empty HOME made the theme
paths relative to the working directory.

ALI-2103
…eave

From review round 2: modifiers held when the keyboard left or was removed
stayed set, so keys were ignored until the next modifiers event; a held
Backspace kept repeating after Ctrl, Alt or Super went down; a mouse press
survived a pointer leave without a release; View::pressed's doc said mouse
only.

ALI-2101
From review round 2: "1 234.5 6" pasted as 1234.56, since only the whole
part was checked for spaces (and a guard on it could never be true);
Shift or Ctrl with numpad 0 under NumLock (KP_Insert) pasted or copied
instead of typing 0. Only the main Insert key now takes part in those
chords. The README gains a Use section.

ALI-2102
From review round 2: bench/run exited 0 when Alias Calc's own measurement
failed as long as another app was measured; stop() left helper processes
in the app's group once the leader exited on SIGTERM; a missing
XDG_RUNTIME_DIR gave a raw KeyError. Also ignore only .claude/worktrees/
rather than all of .claude/.

ALI-2097
From review round 3: AccessKit announces a live node by its name, and
only a Label's name comes from its value, so the Role::Status node never
announced "Copied"; it's a Label like the expression and result. The
engine shows very large and small results in exponent form (1.5e+20,
1e-05), which spoken() turned into "1e minus 05"; it now says "1 times
10 to the power of minus 5". With a screen reader, a click now shows
the ring on the key, so the heard focus moves there even when the ring
was hidden. The trace line marks a start only when the bridge started.

ALI-2114
main's tree matches the #5 head this branch already merged, so this
branch's versions are kept.
…pdate) into ali-2107-show-that-a-copy-happened
…e) into ali-2110-meet-wcag-aa-contrast-with-any-theme
…stack update) into ali-2113-meet-wcag-22-aa-key-borders-keyboard-focus
…ocus (stack update) into ali-2114-screen-reader-support-orca-through
Mike didn't like the outlines, and WCAG doesn't ask for them: 1.4.11
covers the visual information needed to identify a control, and each
key is identified by its label (4.5:1, from #9), not its boundary. This
is the call #9 made; the outlines came from the ticket's wording. The
focus ring stays (2.4.7), drawn in the digit colour, and outlined_rect
goes back to the plain rounded_rect.

ALI-2113
…a-key-borders-keyboard-focus' into aliasbot/ali-2114-screen-reader-support-orca-through
Mike: the built-in colours were "that ugly shade of purple" (Tokyo
Night: #1a1b26, #c0caf5, #7aa2f7). They're used until the theme is read
and whenever there's no theme file, and the design canvas shows them as
the default. They're now the default aliasOS theme (themes/aliasos/
colors.toml): background #131A1F, foreground #D8DDE0, accent #7F96A1.
The pinned-theme test covers them at 4.5:1.

ALI-2143
From review: the test checked three of the built-in palette's colours,
so a changed foreground would have passed. It now compares
Palette::default() with the tested aliasOS row as a whole.

ALI-2143
For the aliasos-pkgs PKGBUILD (ALI-2104), the way Alias Notes does it:
install.sh puts the binary, the screen reader library, the desktop entry
and the icons under PREFIX (~/.local, or /usr with DESTDIR for the
package), each through a temporary name and a rename so a running
calculator keeps its files. The launcher shows "Calculator"
(com.aliasproject.calc). The library goes in PREFIX/lib/alias-calc, so
the loader now also looks there, beside the binary's bin, before
/usr/lib/alias-calc. The icons are a labelled placeholder (direction A
from the design canvas) until the logo is chosen.

ALI-2104
@linear-code

linear-code Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
ALI-2104 Package alias-calc in aliasos-pkgs

Add pkgbuilds/alias-calc/PKGBUILD following the alias-notes one: a pinned tag and commit, cargo fetch --locked, x86_64 and aarch64. It also installs the desktop file (com.aliasproject.calc.desktop: Name=Calculator, GenericName=Calculator, Keywords=alias-calc;calc;math;, Categories=Utility;Calculator;) and an icon.

Runtime depends are only glibc, gcc-libs, wayland and libxkbcommon.

Done when

  • The package builds and installs cleanly.
  • pacman -Qi alias-calc shows an installed size under 2 MB.

Review in Linear

…alls

From review: the desktop entry and icons were written in place, so a
killed install could leave half a .desktop; they now go through put()
like the binary and library. LIB without BIN was silently replaced by a
build; it's now an error. The summary lists the icons, the README gives
the library's search order and the packaging command with BIN and LIB,
and the keywords include alias-calc, as ALI-2104 asks. CI now does a
staged install and uninstall of the release build and validates the
desktop entry.

ALI-2104
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 1, by a fresh reviewer. code-review ran on this PR. It found no P1 or P2 issues. It confirmed:

  • install.sh is safe under set -eu, including the && || check and put() called more than once;
  • uninstall removes only the files install put there;
  • the Exec quoting is safe;
  • the search order in candidates() and its test are right;
  • the desktop entry validates;
  • 16 and 24 px SVGs are valid in hicolor.

Fixed in a96f2c7 (all P3):

  • The desktop entry and icons were written in place, so a killed install could leave half a file. They now go through put()'s temporary name and rename, like the binary and the library.
  • LIB set without BIN was silently replaced by a build. It's now an error.
  • The install summary lists the icons.
  • The README gives the library's full search order, and the packaging command with BIN and LIB.
  • CI now does a staged install and uninstall of the release build, checks the six files and the Exec line, and runs desktop-file-validate.
  • The keywords now include alias-calc, as ALI-2104 asks.

Not changed: the reviewer also flagged a pre-existing debug_assert! in ui.rs, which guards label contrast only in debug builds. It's merged code from #9, outside this PR, and any_theme_meets_aa covers it over 20,000 themes. It stays a draft until the logo is chosen.

From review round 2: it was made in $TMPDIR, so an interrupted install
left it there. It's now named like put()'s temporary files, which
uninstall removes.

ALI-2104
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 2, on a96f2c7 and 252032b, by a fresh reviewer who reviewed by hand. Its background code-review run didn't report. It found no P1 or P2 issues. It confirmed:

  • every file now goes through put(), and its traps clobber nothing;
  • the uninstall cleanup of temporary files is safe under set -u when the folders don't exist;
  • LIB without BIN now errors;
  • the CI step runs after the release build and its checks are right;
  • the README's search order matches the code;
  • aliasos-pkgs#89's new README block matches the Alias Notes one line for line.

Fixed in 3dd4eea (P3): the desktop entry's temporary file was made in $TMPDIR, so an interrupted install left it there. It's now made beside the entry, named like put()'s temporary files, so uninstall removes it. Clean.

…s-default-theme-as-the-built' into aliasbot/ali-2104-package-alias-calc-for-aliasos
Base automatically changed from aliasbot/ali-2143-use-the-aliasos-default-theme-as-the-built to main November 26, 2026 02:47
The four operators, + − × /, on the Alias family tile with an amber
corner (M2 on the design canvas), replacing the placeholder. The 24 and
16 px files are drawn on the pixel grid.
The × sat half a pixel right and high, and the / a pixel right of the −
above it. Both now centre on the same columns and row as the 512-unit
icon (8 and 16).
@michaelaguiar michaelaguiar changed the title ALI-2104: Package Alias Calc: install.sh, desktop entry, placeholder icons ALI-2104: Package Alias Calc: install.sh, desktop entry, icons Nov 26, 2026
The library is loaded only while Orca runs, so size matters more than
speed there. A release-a11y profile (opt-level "z") takes it from 2.7 to
1.9 MB, and the package from 3.7 to 2.9 MB; the binary keeps the
release profile. opt-level on the a11y package alone made it bigger
(3.1 MB), since its 78 dependencies stayed at level 3, so it gets a
profile of its own.

install.sh builds each with its profile, CI builds the library the same
way and installs that one, and desktop-file-validate now checks the
installed entry, with its rewritten Exec line, instead of the template.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 4 covered the whole PR and the icon commits, with code-review run in full. It found no P1 or P2 problems.

Confirmed

  • The 24 px icon is now centred: all four signs sit on x 8/16 and y 8/16, as in the 512-unit icon.
  • No sign touches the amber corner.
  • A staged install puts 6 files in place, and uninstall removes all 6.
  • candidates() lists the library locations in the right order, with no duplicates.

Fixed (ee13d66)

  • desktop-file-validate in CI now checks the installed entry, with its rewritten Exec line, instead of the template.

Declined

  • Keywords beyond the ticket's list (P3): arithmetic and Alias Calc are deliberate. The launcher name is "Calculator", so without Alias Calc a search for the product name finds nothing. The PR description now says so.
  • No design/tokens.json (P3): this is real, but it belongs to the planned design-token and canvas restructure, not to packaging. The icons use the Alias family's colours (from Alias Notes), not this app's theme.
  • Nits:
    • The desktop entry's temp file has no trap. If an install is interrupted, uninstall removes it.
    • PREFIX=/usr/ produces // in the Exec path, which still resolves.
    • One trap exits 130 for every signal.
    • The binary is matched by name, and the workspace has one binary.
    • The file count in CI is hard-coded to 6 on purpose, to catch stray files.

Also in ee13d66, beyond the review: the screen reader library builds with its own size-first profile, release-a11y. That takes it from 2.7 to 1.87 MB, and the installed package to 2.9 MB. Round 5 reviews this commit.

alias-calc never reads the activation token a launcher hands it
(xdg-activation), so StartupNotify=true would leave launchers waiting on
a startup signal that never comes. It opens in well under the time such
feedback would show anyway.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 5 covered ee13d66, the size profile, and aliasos-pkgs#89's 2b892cd, with code-review run in full. It found no P1 or P2 problems.

Confirmed

  • A failed first or second build inside the command substitution stops install.sh under set -eu.
  • The JSON from the real builds yields exactly one binary path (release/alias-calc) and one library path (release-a11y/libalias_calc_a11y.so).
  • Nothing still points at the plain-release library where the packaged one is meant.
  • inherits = "release" keeps fat LTO, codegen-units = 1, panic = "abort" and strip.
  • No behaviour in the a11y crate depends on the optimisation level.
  • The CI steps run in a sensible order.

Fixed (b8925be)

  • StartupNotify=true with no activation-token handling (P3): alias-calc never reads the xdg-activation token, so launchers would wait for a startup signal that never comes. The entry is now StartupNotify=false.

Declined

  • uninstall leaves empty directories: they're the shared bin/, share/applications/ and hicolor folders, which other packages use too. pacman handles a package's directories itself.
  • No CI run of the cargo-JSON build path: running it would mean a third full release build in CI. It was run by hand on ee13d66.
  • The Exec rewrite would miss a future %U: the app takes no arguments, and CI's grep -x fails if the rewrite ever stops matching.
  • The exe/../lib/alias-calc candidate: it was reviewed in earlier rounds and is outside this commit.
  • The icon colours: already declined in round 4.

@michaelaguiar
michaelaguiar marked this pull request as ready for review November 26, 2026 03:55
@michaelaguiar
michaelaguiar merged commit e3379f9 into main Nov 26, 2026
1 check passed
@michaelaguiar
michaelaguiar deleted the aliasbot/ali-2104-package-alias-calc-for-aliasos branch November 26, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant