Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
297aca8
Set up the crate, CI and the benchmark harness
michaelaguiar Nov 25, 2026
dbff06d
Open the window: xdg toplevel drawn into a wl_shm buffer
michaelaguiar Nov 25, 2026
b9889b7
Add the calculator engine with exact decimal math
michaelaguiar Nov 25, 2026
47a8160
Draw the calculator: rounded rectangles, embedded fonts, keypad
michaelaguiar Nov 25, 2026
f1c0998
Ignore .claude/ and drop the agent worktree committed by mistake
michaelaguiar Nov 25, 2026
e3527d8
Merge the engine (ALI-2100) into the keypad branch
michaelaguiar Nov 25, 2026
4b5264d
Wire the keypad: keyboard, mouse and Backspace repeat
michaelaguiar Nov 25, 2026
e7e362c
Follow the live aliasOS theme
michaelaguiar Nov 25, 2026
37d01b0
Make the keyboard after the first frame
michaelaguiar Nov 25, 2026
df46ea5
Merge branch 'aliasbot/ali-2101-keypad-ui-with-keyboard-and-mouse-inp…
michaelaguiar Nov 25, 2026
dec0081
Bind the pointer after the first frame too, and send that frame first
michaelaguiar Nov 25, 2026
5ca223a
Merge branch 'aliasbot/ali-2101-keypad-ui-with-keyboard-and-mouse-inp…
michaelaguiar Nov 25, 2026
e94dd88
Copy and paste numbers
michaelaguiar Nov 25, 2026
7f23404
Make the benchmark harness fail loudly instead of measuring wrong
michaelaguiar Nov 25, 2026
05d04bf
Merge the reviewed harness (ALI-2097) into ALI-2098
michaelaguiar Nov 25, 2026
0814eb0
Don't hang unseen, keep flushing a full socket, size each axis
michaelaguiar Nov 25, 2026
835c3ed
Merge remote-tracking branch 'origin/aliasbot/ali-2098-open-a-wayland…
michaelaguiar Nov 25, 2026
e0dfd12
Whole-pixel text, bounded glyph cache, hit-test what's drawn
michaelaguiar Nov 25, 2026
a441aef
Merge the reviewed renderer (ALI-2099) into ALI-2101
michaelaguiar Nov 25, 2026
ed6b280
Fix lost digits, division residue and promoted float powers
michaelaguiar Nov 25, 2026
764ee81
Tear input down with its seat, stop repeat when disabled, never starv…
michaelaguiar Nov 25, 2026
ad1a653
Merge the reviewed engine (ALI-2100) into ALI-2101
michaelaguiar Nov 25, 2026
7e4c95a
Fall back per file, watch every theme source, keep the last good colors
michaelaguiar Nov 25, 2026
7377baf
Merge the reviewed theme (ALI-2103) into ALI-2102
michaelaguiar Nov 25, 2026
f0c973a
Paste spaces only as separators, keep a pending paste, follow aliasOS…
michaelaguiar Nov 25, 2026
017df23
Don't wake for theme.name writes; ignore an empty HOME
michaelaguiar Nov 25, 2026
e794eab
Forget modifiers with focus, stop repeat on a chord, end a press on l…
michaelaguiar Nov 25, 2026
fb4fe78
No spaces after the decimal mark, leave numpad 0 alone, document use
michaelaguiar Nov 25, 2026
d690076
Fail the run without Alias Calc's row, kill leftover helpers
michaelaguiar Nov 25, 2026
9240e17
Merge remote-tracking branch 'origin/aliasbot/ali-2097-set-up-the-ali…
michaelaguiar Nov 25, 2026
85790c9
Merge the reviewed harness (ALI-2097) and end on a broken socket
michaelaguiar Nov 25, 2026
574364a
Use a fixed working precision, keep % exact, fix paste edge cases
michaelaguiar Nov 25, 2026
346511d
Never clip the result; draw and hit-test from the same logical size
michaelaguiar Nov 25, 2026
740d092
Merge the round-2 renderer and window fixes (ALI-2099, ALI-2098) into…
michaelaguiar Nov 25, 2026
346ca87
Merge the round-2 engine fixes (ALI-2100) into ALI-2101
michaelaguiar Nov 25, 2026
ed95234
Merge the round-2 keypad, renderer, window and engine fixes into ALI-…
michaelaguiar Nov 25, 2026
acf0cf7
Merge the round-2 fixes below (ALI-2103 and its stack) into ALI-2102
michaelaguiar Nov 25, 2026
bfaab37
Snap cancellation to zero, keep large whole floats approximate
michaelaguiar Nov 25, 2026
5ec3bb8
Snap float cancellation at 10^-15, not 10^-14
michaelaguiar Nov 25, 2026
11c8a3c
Merge remote-tracking branch 'origin/aliasbot/ali-2100-calculator-eng…
michaelaguiar Nov 25, 2026
8305a38
Merge remote-tracking branch 'origin/aliasbot/ali-2101-keypad-ui-with…
michaelaguiar Nov 25, 2026
c478b23
Merge remote-tracking branch 'origin/aliasbot/ali-2103-follow-the-liv…
michaelaguiar Nov 25, 2026
2aead7b
Track how exact each value is, and round and snap only inexact ones
michaelaguiar Nov 25, 2026
b97f730
Decide exactness against the true value, keep guarded digits
michaelaguiar Nov 25, 2026
f1e5a7f
Merge remote-tracking branch 'origin/aliasbot/ali-2100-calculator-eng…
michaelaguiar Nov 25, 2026
5fbde28
Merge remote-tracking branch 'origin/aliasbot/ali-2101-keypad-ui-with…
michaelaguiar Nov 25, 2026
5d18d78
Merge remote-tracking branch 'origin/aliasbot/ali-2103-follow-the-liv…
michaelaguiar Nov 25, 2026
2c0b27c
Show f64-derived decimals at 15 digits; don't loop on a zero's exponent
michaelaguiar Nov 25, 2026
b5e24eb
Merge remote-tracking branch 'origin/aliasbot/ali-2100-calculator-eng…
michaelaguiar Nov 25, 2026
bce1fb7
Merge remote-tracking branch 'origin/aliasbot/ali-2101-keypad-ui-with…
michaelaguiar Nov 25, 2026
c0afd55
Merge remote-tracking branch 'origin/aliasbot/ali-2103-follow-the-liv…
michaelaguiar Nov 25, 2026
b601762
Show "Copied" after a copy
michaelaguiar Nov 25, 2026
a71676b
End "Copied" on any click and on Ctrl+V; fix stale comments
michaelaguiar Nov 25, 2026
fd1e680
Meet WCAG AA contrast with any theme
michaelaguiar Nov 25, 2026
37ec033
Give all text 4.5:1, at every size it's drawn
michaelaguiar Nov 25, 2026
809178f
Assert the key-label loop passes; doc and test tidy-ups
michaelaguiar Nov 25, 2026
f4c9f20
Meet WCAG 2.2 AA: key outlines, keyboard focus, 44 px keys, text size
michaelaguiar Nov 25, 2026
f559e88
Keep keys at 44 px when text grows; = outline on both fills; tidy-ups
michaelaguiar Nov 25, 2026
0fdfae2
Share the key outline colour between keys and the = key
michaelaguiar Nov 25, 2026
cb5b9c7
Screen reader support through AccessKit, loaded only when Orca runs
michaelaguiar Nov 25, 2026
bec0d36
Build on aarch64; try every library path; heard focus is drawn focus
michaelaguiar Nov 25, 2026
e48a4f1
ALI-2102: Copy and paste numbers (#7)
michaelaguiar Nov 25, 2026
1373b93
Speak operators and Copied; keep the ring on clicks with a screen reader
michaelaguiar Nov 25, 2026
23988c7
Announce Copied; speak exponents; with Orca a click shows the ring
michaelaguiar Nov 25, 2026
61f6643
Merge origin/main (#5 squashed) into ALI-2103
michaelaguiar Nov 25, 2026
1f2b373
Merge origin/aliasbot/ali-2103-follow-the-live-aliasos-theme (stack u…
michaelaguiar Nov 25, 2026
2c7b2fd
Merge origin/aliasbot/ali-2107-show-that-a-copy-happened (stack updat…
michaelaguiar Nov 25, 2026
9819e10
Merge origin/aliasbot/ali-2110-meet-wcag-aa-contrast-with-any-theme (…
michaelaguiar Nov 25, 2026
6fa76fc
Merge origin/aliasbot/ali-2113-meet-wcag-22-aa-key-borders-keyboard-f…
michaelaguiar Nov 25, 2026
ac6dc1f
Drop the key outlines; keep the focus ring
michaelaguiar Nov 26, 2026
b53d242
Merge remote-tracking branch 'origin/aliasbot/ali-2113-meet-wcag-22-a…
michaelaguiar Nov 26, 2026
dde9ab0
Use the aliasOS default theme as the built-in colours
michaelaguiar Nov 26, 2026
5d7199a
Pin the whole built-in palette to the aliasOS default row
michaelaguiar Nov 26, 2026
5d5b83b
Package Alias Calc: install.sh, desktop entry, placeholder icons
michaelaguiar Nov 26, 2026
a96f2c7
install.sh: put every file in place by rename; LIB needs BIN; CI inst…
michaelaguiar Nov 26, 2026
3dd4eea
install.sh: make the desktop entry's temporary file beside it
michaelaguiar Nov 26, 2026
b21e076
Merge origin/main (#11 squashed) into ali-2143-use-the-aliasos-defaul…
michaelaguiar Nov 26, 2026
cdcaa45
Merge remote-tracking branch 'origin/aliasbot/ali-2143-use-the-aliaso…
michaelaguiar Nov 26, 2026
b6cf83e
Merge origin/main (#12 squashed) into ali-2104-package-alias-calc-for…
michaelaguiar Nov 26, 2026
c9563b8
Use the chosen logo for the icons
michaelaguiar Nov 26, 2026
2ccb95a
Centre the bottom row of the 24 px icon
michaelaguiar Nov 26, 2026
ee13d66
Build the screen reader library for size
michaelaguiar Nov 26, 2026
b8925be
Don't promise startup notification in the desktop entry
michaelaguiar Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
- run: cargo test --workspace --locked
- run: cargo build --workspace --release --locked
# The screen reader library as it's packaged: its own size-first profile.
- run: cargo build --profile release-a11y --locked -p alias-calc-a11y
# aliasOS also runs on Apple Silicon: c_char is u8 there, so FFI
# mistakes only show on aarch64. A type check needs no cross linker.
- name: Type-check for aarch64
Expand All @@ -69,10 +71,25 @@ jobs:
# ignored in the debug test run.
- name: Performance budgets
run: cargo test --release --locked -- --ignored budget_ --test-threads=1
- name: Benchmark scripts parse
- name: Scripts parse
run: |
python3 -m py_compile bench/calcbench.py
bash -n bench/run
sh -n install.sh
# A staged install and uninstall of the release build, as the
# PKGBUILD does it, and the installed desktop entry checked.
- name: Install and uninstall
run: |
apt-get install -y -qq --no-install-recommends desktop-file-utils >/dev/null
stage=$(mktemp -d)
PREFIX=/usr DESTDIR="$stage" BIN=target/release/alias-calc \
LIB=target/release-a11y/libalias_calc_a11y.so ./install.sh
desktop-file-validate "$stage/usr/share/applications/com.aliasproject.calc.desktop"
test "$(find "$stage" -type f | wc -l)" -eq 6
grep -qx 'Exec="/usr/bin/alias-calc"' "$stage/usr/share/applications/com.aliasproject.calc.desktop"
PREFIX=/usr DESTDIR="$stage" ./install.sh uninstall
test "$(find "$stage" -type f | wc -l)" -eq 0
rm -rf "$stage"
- name: Hand the workspace back to the runner user
if: always()
run: chown -R 1001:1001 "$GITHUB_WORKSPACE" "$RUNNER_TEMP"
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ strip = true

[profile.dev.package."*"]
opt-level = 2

# The screen reader library (a11y/) is packaged from this profile: it's loaded
# only while Orca runs, so size matters more than speed there. "z" takes it
# from 2.7 to 1.9 MB. The binary keeps `release`.
[profile.release-a11y]
inherits = "release"
opt-level = "z"
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ cargo build --workspace --release

The binary is `target/release/alias-calc`. The aim is to link nothing beyond libc and `libxkbcommon` (for keyboard layouts), with a pure-Rust Wayland client.

Screen reader support is a separate library, `target/release/libalias_calc_a11y.so` (the `a11y/` crate, with AccessKit). The calculator loads it only when Orca is running, from beside its binary or from `/usr/lib/alias-calc/`, so without a screen reader it costs nothing. A package installs it to `/usr/lib/alias-calc/`.
Screen reader support is a separate library, `target/release/libalias_calc_a11y.so` (the `a11y/` crate, with AccessKit). The calculator loads it only when Orca is running, from beside its binary, from `lib/alias-calc/` beside the binary's `bin/` (where `install.sh` puts it), or from `/usr/lib/alias-calc/`, so without a screen reader it costs nothing. A package installs it to `/usr/lib/alias-calc/`, built with its own size-first profile (`cargo build --profile release-a11y -p alias-calc-a11y`, into `target/release-a11y/`): 1.9 MB instead of 2.7 MB.

## Install

```sh
./install.sh # build, then install into ~/.local
./install.sh uninstall
```

It installs `bin/alias-calc`, the screen reader library in `lib/alias-calc/`, the desktop entry (`packaging/com.aliasproject.calc.desktop`, "Calculator" in the launcher) and the icons (`packaging/icons`). aliasOS packages it from the `alias-calc` PKGBUILD in aliasos-pkgs, which builds both first and then runs `PREFIX=/usr DESTDIR="$pkgdir" BIN=target/release/alias-calc LIB=target/release-a11y/libalias_calc_a11y.so ./install.sh`: with `BIN` and `LIB` set, nothing is built.

## Benchmark

Expand Down
153 changes: 153 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#!/bin/sh
# Installs Alias Calc from this checkout: the release binary, the screen
# reader library (loaded only while Orca runs), the desktop entry and the
# icons.
#
# ./install.sh build, then install into ~/.local
# ./install.sh uninstall remove what install put there
#
# PREFIX=/usr DESTDIR=pkg ./install.sh (packaging: aliasos-pkgs' PKGBUILD)
# BIN=path/to/alias-calc LIB=path/to/libalias_calc_a11y.so ./install.sh
# (install those, no build)
#
# PREFIX defaults to ~/.local; DESTDIR, if set, is put in front of every
# path (for staging), and then no caches are refreshed. The library goes in
# PREFIX/lib/alias-calc, one of the places src/a11y.rs looks for it.
set -eu

here=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
prefix=${PREFIX:-$HOME/.local}
destdir=${DESTDIR:-}
app=com.aliasproject.calc
library=libalias_calc_a11y.so

# The prefix goes into the desktop entry's Exec line, quoted, and must
# start the app from any directory: refuse a relative one, and characters
# that line (or sed) would read as something else.
case $prefix in
/*) ;;
*)
printf 'install.sh: PREFIX must be an absolute path: %s\n' "$prefix" >&2
exit 1
;;
esac
case $prefix in
*[\"\`\$\\%\&\|]* | *[[:cntrl:]]*)
printf 'install.sh: PREFIX can'"'"'t hold any of " ` $ \\ %% & | or a control character: %s\n' "$prefix" >&2
exit 1
;;
esac

bindir=$destdir$prefix/bin
libdir=$destdir$prefix/lib/alias-calc
appdir=$destdir$prefix/share/applications
icondir=$destdir$prefix/share/icons/hicolor

say() { printf '%s\n' "$*"; }

# Launchers read these caches; a user's ~/.local may have none. The icon
# cache is only refreshed if there is one already: a cache made here would
# hide icons that later installs add without refreshing it.
refresh() {
[ -z "$destdir" ] || return 0
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database -q "$appdir" || true
fi
if [ -f "$icondir/icon-theme.cache" ] && command -v gtk-update-icon-cache >/dev/null 2>&1; then
gtk-update-icon-cache -q -f -t "$icondir" || true
fi
}

# Copies $1 to $2 through a temporary name in the same folder, then renames
# it: a running alias-calc keeps the files it has open, and nothing ever
# sees half a file.
put() {
mkdir -p "$(dirname "$2")"
tmp=$(mktemp "$(dirname "$2")/.alias-calc.tmp.XXXXXX")
trap 'rm -f "$tmp"' EXIT
trap 'exit 130' INT TERM HUP
if ! { cp "$1" "$tmp" && chmod "$3" "$tmp" && mv -f "$tmp" "$2"; }; then
say "install.sh: couldn't put $2" >&2
exit 1
fi
trap - EXIT INT TERM HUP
}

uninstall() {
rm -f "$bindir/alias-calc" "$libdir/$library" "$appdir/$app.desktop" \
"$icondir/scalable/apps/$app.svg" "$icondir/16x16/apps/$app.svg" \
"$icondir/24x24/apps/$app.svg"
rmdir "$libdir" 2>/dev/null || true
# And any temporary file an install that was killed left.
for left in "$bindir"/.alias-calc.tmp.?????? "$libdir"/.alias-calc.tmp.?????? \
"$appdir"/.alias-calc.tmp.?????? "$icondir"/*/apps/.alias-calc.tmp.??????; do
if [ -f "$left" ]; then rm -f "$left"; fi
done
refresh
say "Removed Alias Calc from $destdir$prefix."
}

install_() {
bin=${BIN:-}
lib=${LIB:-}
# Both or neither: a build would replace a LIB given on its own.
if [ -n "$lib" ] && [ -z "$bin" ]; then
say "install.sh: set BIN with LIB (or neither, to build both)" >&2
exit 1
fi
if [ -z "$bin" ]; then
command -v cargo >/dev/null 2>&1 || {
say "install.sh: cargo is needed to build (or set BIN and LIB to built files)" >&2
exit 1
}
say "Building the release binary and the screen reader library..."
# The paths cargo reports for what it built, wherever its target
# dir puts them. (Kept, then read: a failed build stops here.) The
# library has its own size-first profile (release-a11y, Cargo.toml).
built=$(cd "$here" && cargo build --release --locked -p alias-calc \
--message-format=json-render-diagnostics &&
cargo build --profile release-a11y --locked -p alias-calc-a11y \
--message-format=json-render-diagnostics)
bin=$(printf '%s\n' "$built" | sed -n 's/.*"executable":"\([^"]*alias-calc\)".*/\1/p' | tail -n 1)
lib=$(printf '%s\n' "$built" | grep -o "\"[^\"]*/$library\"" | tr -d '"' | tail -n 1)
[ -n "$bin" ] || { say "install.sh: cargo didn't report a built alias-calc" >&2; exit 1; }
fi
[ -x "$bin" ] || { say "install.sh: no binary at $bin" >&2; exit 1; }
[ -n "$lib" ] && [ -f "$lib" ] || { say "install.sh: no $library (set LIB)" >&2; exit 1; }

put "$bin" "$bindir/alias-calc" 755
put "$lib" "$libdir/$library" 755

# The full path (quoted, for a PREFIX with spaces), so launchers find it
# whether or not PREFIX/bin is on their PATH. Written beside the source
# first, then put in place like the rest.
# (Named like put()'s temporary files, so an interrupted install leaves
# nothing that uninstall won't remove.)
mkdir -p "$appdir"
entry=$(mktemp "$appdir/.alias-calc.tmp.XXXXXX")
sed "s|^Exec=alias-calc\$|Exec=\"$prefix/bin/alias-calc\"|" \
"$here/packaging/$app.desktop" >"$entry"
put "$entry" "$appdir/$app.desktop" 644
rm -f "$entry"

# The mark at any size, and the pixel-grid files where it's drawn small.
for target in scalable:$app.svg 16x16:$app-16.svg 24x24:$app-24.svg; do
put "$here/packaging/icons/${target#*:}" "$icondir/${target%%:*}/apps/$app.svg" 644
done

refresh
say "Installed Alias Calc in $destdir$prefix:"
say " $bindir/alias-calc"
say " $libdir/$library (screen readers)"
say " $appdir/$app.desktop (\"Calculator\" in the launcher)"
say " $icondir/{scalable,16x16,24x24}/apps/$app.svg"
}

case "${1:-install}" in
install) install_ ;;
uninstall) uninstall ;;
*)
say "usage: ./install.sh [install|uninstall]" >&2
exit 2
;;
esac
12 changes: 12 additions & 0 deletions packaging/com.aliasproject.calc.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Desktop Entry]
Type=Application
Name=Calculator
GenericName=Calculator
Comment=A tiny, instant calculator
Exec=alias-calc
Icon=com.aliasproject.calc
Terminal=false
Categories=Utility;Calculator;
Keywords=alias-calc;calc;math;arithmetic;Alias Calc;
StartupNotify=false
StartupWMClass=com.aliasproject.calc
2 changes: 2 additions & 0 deletions packaging/icons/com.aliasproject.calc-16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packaging/icons/com.aliasproject.calc-24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packaging/icons/com.aliasproject.calc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 29 additions & 7 deletions src/a11y.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,26 @@ unsafe extern "C" {
fn dlerror() -> *const c_char;
}

/// Where the library may be: beside the binary (a build tree, or a package
/// that keeps them together), then where the package installs it.
/// Where the library may be, in order: beside the binary (a build tree),
/// in `lib/alias-calc` beside the binary's `bin` (install.sh: `/usr` for the
/// package, `~/.local` for a user install), then the package's path.
fn library_paths() -> Vec<PathBuf> {
let exe = std::env::current_exe().ok();
candidates(exe.as_deref())
}

fn candidates(exe: Option<&std::path::Path>) -> Vec<PathBuf> {
let mut paths = Vec::new();
if let Ok(exe) = std::env::current_exe()
&& let Some(dir) = exe.parent()
{
if let Some(dir) = exe.and_then(|e| e.parent()) {
paths.push(dir.join(LIBRARY));
if let Some(prefix) = dir.parent() {
paths.push(prefix.join("lib/alias-calc").join(LIBRARY));
}
}
let package = PathBuf::from("/usr/lib/alias-calc").join(LIBRARY);
if !paths.contains(&package) {
paths.push(package);
}
paths.push(PathBuf::from("/usr/lib/alias-calc").join(LIBRARY));
paths
}

Expand Down Expand Up @@ -472,7 +482,19 @@ mod tests {
}

#[test]
fn looks_beside_the_binary_first() {
fn looks_beside_the_binary_then_under_its_prefix() {
let home = candidates(Some(std::path::Path::new("/home/m/.local/bin/alias-calc")));
assert_eq!(
home,
[
PathBuf::from("/home/m/.local/bin").join(LIBRARY),
PathBuf::from("/home/m/.local/lib/alias-calc").join(LIBRARY),
PathBuf::from("/usr/lib/alias-calc").join(LIBRARY),
]
);
// The package's own path isn't listed twice.
let package = candidates(Some(std::path::Path::new("/usr/bin/alias-calc")));
assert_eq!(package.len(), 2);
let paths = library_paths();
assert_eq!(
paths.last().unwrap(),
Expand Down
Loading