# cont8nuum desktop

A Windows 8 / Metro-style Wayland desktop: a wlroots compositor with Start,
live tiles and charms, a Metro UI toolkit, and apps built on it. C11, meson,
FOSS dependencies only (prefer free/open tooling). A personal project
by lowtide, a pseudonym: credit lowtide wherever a credit is needed, and
keep anything else that identifies the author out of what is published
(site, READMEs, copyright lines, screenshots).

## Layout

One git repo holds everything we write (build scripts, these docs,
`packaging/` with `packaging/oo7/`'s patch, and every component; commits
as lowtide <lowtide.sbs@posteo.pm>, set in the repo's config). Folders
are grouped by what they are; programs, packages and meson projects keep
their `c8-` names (`desktop/shell/` builds `c8-shell`). Submodules are
only for what isn't ours or has a life of its own: upstream's OpenXR SDK
and xrizer under `xr/`, and (once their repos are up) our Monado fork
and the website. Clone with `--recurse-submodules`, or
`git submodule update --init`; `xr/build.sh` fetches its own when
they're missing.

| Dir | What | Depends on |
|---|---|---|
| `protocols/` | Our Wayland protocols and D-Bus interfaces (`c8-protocols`) | – |
| `theme/` | Font, icon theme, SDDM theme (`c8-theme`) | – |
| `toolkit/c8ui/` | The Metro UI toolkit, and `c8-base` (shared, no UI) | – |
| `toolkit/lua/` | `c8-lua`, which runs apps and tiles written in Lua; built only for the Lua apps | c8ui |
| `compositor/` | The compositor, `c8` (wlroots 0.20); XR | protocols, c8ui |
| `desktop/widgets/` | `c8tile`, `c8-widget` live tile providers | c8-base |
| `desktop/settings/` | PC settings, `c8-accounts`, `c8-sync` | c8ui, protocols |
| `desktop/shell/` | `c8-shell`: Start, charms, toasts; lock, askpass, polkit, wallet, share | c8ui, protocols |
| `apps/files/` `apps/news/` `apps/tailscale/` `apps/weather/` `apps/tiles/` `apps/cirrus/` `apps/photos/` `apps/video/` | The apps (`c8-files` and so on) | c8ui |
| `apps/lua/` | Our apps written in Lua (Calculator, Clock, Editor, Merge, Mines, Notes, Reversi) | toolkit/lua |
| `xr/` | Monado (with our glasses driver) and the OpenXR loader, for VR games in XR. Only with `build.sh --xr` | `compositor/src/imu.c` (source) |
| `web/` | The website (PHP + MariaDB), `c8-online`. Not built by `build.sh`; its secrets are ignored by `web/.gitignore` | – |
| `packaging/` | `requirements.txt` (the zypper list), the deps RPM, oo7's build and patch, `release/` (the release tarball), `stage.sh`, `deb/`, `rpm/`, `distro/` (what each distribution must have at run time) and `private-libs.sh` (the distribution packages; see CI) | – |
| `docs/` | `APPS-TODO.md`, `to-claude.txt` (installing by asking Claude), `todo` | – |

## Where the notes are

Each directory above has a `CLAUDE.md` of its own: what the component
is, its packages, how its source is laid out, why things are as they
are, what was tested and what wasn't. It loads by itself when a file in
that directory is read. This file holds only what crosses components.

- Read a component's `CLAUDE.md` before planning work on it, and
  another's when the work reaches into it. Don't read the ones a task
  doesn't touch.
- Anything with app UI: `toolkit/c8ui/CLAUDE.md` (narrow windows, events,
  widget lifetime), then `toolkit/c8ui/WIDGETS.md` (what there is to build
  with) and `toolkit/c8ui/DRAWING.md` (damage, drawing fast: before any draw
  fn). c8-base: `toolkit/c8ui/base/CLAUDE.md`.
- XR and the glasses: `compositor/XR.md` (not loaded by itself; it is
  long), with the shell's side in `desktop/shell/PANELS.md`. VR games
  (Monado, the overlay, leasing): `compositor/MONADO-XR.md`, XR.md's
  Monado section and `xr/CLAUDE.md`.
- Live tiles: `desktop/shell/LIVE-TILES.md`. An app's colour and icon:
  `desktop/shell/CLAUDE.md`. App charms, quick settings, the tray:
  `desktop/shell/PANELS.md`. Lock, askpass, polkit, wallet, the sharing
  picker: `desktop/shell/LOCK-AUTH.md`.
- Only a directory's `CLAUDE.md` loads by itself; the other files
  named here and in those are read when the work is in them.
- A new app: copy `toolkit/c8ui/template/`, give it a `CLAUDE.md`, a row above,
  and the `build.sh`/`install.sh` entries named below.
- What you learn about a component goes in its own file, in the same
  change; here only if every component needs it. Keep a note to what
  the code can't say (why, traps, tested/untested), and replace what a
  change made stale rather than adding beside it.

## Building

`build.sh` builds them in dependency order into `./.prefix` (default, for
nested testing) or `./build.sh --install` (= `--prefix /usr/local`, the
user's real session install; SDDM uses `/usr/local/share/wayland-sessions`). Without a terminal, sudo asks through `$SUDO_ASKPASS` (in the
session that's our `c8-askpass`), else `.prefix`'s `c8-askpass`, and
only then ksshaskpass or ssh-askpass. `--stage DIR` (with `--prefix
/usr`) is for packages: each component goes under `DIR/COMPONENT`, no
sudo, nothing installed (see CI).
The desktop and the apps are apart: `--apps LIST` (`all_apps` in
build.sh: lua files news tailscale weather tiles photos video cirrus;
`none`; each is `apps/NAME`, and `lua` builds `toolkit/lua` first)
builds only those beside the desktop's parts (protocols, theme, c8ui,
the compositor, the live tile providers, PC settings, the shell), which must go on
building and running without any app: nothing of the desktop may link
or need one. A new app goes in `all_apps` and in install.sh's
`app_ids`/`app_names`/`app_about`/`app_packages`. An app left out
isn't removed if it was installed before. The shipped Start names none
of our apps: its Files tile is `@default files`, the default file
manager, as the browser's and terminal's are; keep it so.
Each component has its own `build/` dir for `.prefix` and `build-install/`
for any other prefix; `ninja -C <comp>/build` for quick
rebuilds, but components installed into the prefix are what others build
against, so rerun `build.sh` after changing c8ui or the protocols.
Trap: meson's install keeps a header's source mtime, so a `ninja -C
<app>/build` between editing a c8ui header and `build.sh` installing it
leaves objects built against the old header that ninja then thinks are
newer; with a changed struct the layouts disagree (2026-12-01: Cirrus's
`main.c` wrote `user_data` where c8ui keeps `data`: a lost gap, then
crashes). After a struct change don't ninja an app before `build.sh`,
or clean its build (`ninja -C <app>/build -t clean`). Likewise a nested
c8 finds `/usr/local/bin` before `.prefix/bin` unless the test puts
`.prefix/bin` first in PATH (Start's PC settings tile ran the
installed one on the new libraries, its toggles garbled).
Everything builds as `debugoptimized` (-O2 -g): each meson.build's
default, and `build.sh` says it on every setup because a build dir keeps
the type it was made with (meson's own default is `debug`, -O0, which is
what the real session ran until 2026-11-25). `C8_BUILDTYPE=debug
./build.sh` for one to step through.

`install.sh` (bash) is the way in for someone new: questions one at a
time in the manner of Claude Code's (a header, numbered options each
with a line under it, the recommended first; arrows or j/k, a number,
Enter, Esc), then a plan of the very commands, a last "Go ahead?", and
the steps run in order with their output also in `install.log`
(ignored). It only runs what there already is: zypper for the build
packages (openSUSE only; elsewhere none are installed and it says so),
`build.sh [--install]`, `packaging/build-oo7.sh`,
`packaging/make-deps-rpm.sh --install`. Its second question ticks the
apps to build beside the desktop (`ask_many`: Space, a number, `a` for
all or none), passed on as `build.sh --apps`; an app's own build
packages (`app_packages`: libarchive for Files, glycin and gexiv2 for
Photos, mpv and FFmpeg for Video, libxml2 for News) are only asked of zypper when
it's ticked. Every answer is an option too
(`--where install|try`, `--apps`, `--packages`, `--runtime`, `--wallet`,
`--account-url`, `--xr`: Monado for VR games, off unless chosen), `--yes` takes the recommended ones, `--dry-run` stops
after the plan. Its package list is a copy of DEPENDENCIES.md's: keep
them in step, and a new install step belongs in it. Tested through a
pty with `--dry-run` only (keys, the address, Esc, a bad address);
never run for real.

`packaging/make-deps-rpm.sh [--install]` builds `cont8nuum-deps`, an RPM
of only dependencies (`packaging/runtime-deps.txt` plus the packages of
the libraries the installed programs load), so zypper never counts what
cont8nuum uses as unneeded; rebuild and reinstall it after `--install`
when dependencies change. Output in `packaging/build/` (ignored).

`README.md` is the public front door (what it is, building, trying it
nested, keys, licence); keep it true when those change. The components
have no READMEs of their own yet (web/'s aside, and toolkit/lua's,
which is the Lua API's reference).

Licence: everything of ours is CC0 1.0 (`LICENSE`; meson `license:
'CC0-1.0'`, the protocols' headers say so too). Third-party files keep
theirs and are listed in README.md's Licence section: Selawik (OFL),
the two wlr protocol XMLs, snail.zone's logo, `packaging/oo7/` (oo7's
MIT). Add to that list whenever something from elsewhere comes in.

`DEPENDENCIES.md` lists every build and runtime package (Tumbleweed names)
and the files an install writes outside its prefix. Update it in the same
change whenever something new is needed or installed.

## CI

Pushes to `main` build on our spindle, spindle.lowtide.sbs (tack on
Laminar, rootless Podman; its dashboard is the site itself):
`.tangled/workflows/build.yml` runs `.tangled/build.sh` (the release:
`build.sh --apps all` into `/opt/cont8nuum`, then its tarball) in the CI image, `localhost/c8-ci:ubuntu-26.04`:
Ubuntu 26.04 LTS with every build package, and wlroots 0.20 and gexiv2
0.16 built from source (26.04 has 0.19 and 0.14). The image is
`.tangled/image/Containerfile`, built on the spindle by `image.yml`,
which only runs by hand (the Pipelines page): run it after changing the
Containerfile, and a new build dependency goes in both it and
DEPENDENCIES.md. The Monado fork's CI uses the same image. Ubuntu, not
Tumbleweed, because the aim is release tarballs that run on most
distros (glibc 2.43); Debian 13 is too old for wlroots 0.20 (its
wayland, libdrm, xkbcommon, pixman), so it gets packages only (below).
Meson puts the prefix's libraries in `lib/x86_64-linux-gnu` there, not
`lib64`: `build.sh` asks `cc -print-multiarch`. Heavy local test builds
go under `taskset -c 0-3` (podman's `--cpus` fails on Tumbleweed), or
better, on the spindle.

Each repo runs in its own Laminar job (`tack.laminar.job`: `cont8nuum`,
`monado`, `c8-online`). Artifacts: what a build leaves in `$ARTIFACTS`
is served at `spindle.lowtide.sbs/archive/JOB/RUN/NAME`, but only from a
run that succeeded and had no secrets, only regular files with plain
names (no dotfiles, no spaces), 2 GiB at most, and only the last 10
runs' per job. For now every build's are kept; once releases are
tested, the user wants artifacts only from tagged builds.

The release tarball (`packaging/release/`, made by `make-tarball.sh` in
CI) is `cont8nuum-VERSION-DISTRO-ARCH.tar.gz` (VERSION the tag at the
commit, else `git-COMMIT`), with a `.sha256`: the name says what it was
built on, since it uses that distribution's packages. It unpacks to
`/opt/cont8nuum` (paths are built in, so not relocatable) and finds its
libraries by rpath (`-Dc_link_args=-Wl,-rpath,...`, never
LD_LIBRARY_PATH); what the distribution lacks (whatever the programs load
from `/usr/local` in the image: wlroots, gexiv2) is bundled, and the
script proves it by moving `/usr/local`'s copies away and `ldd`-ing every
ELF. `PACKAGES.txt` in it is `packaging/distro/DISTRO.txt` (by hand, each
name checked against the archive) plus the packages of every library
loaded (`dpkg -S`). The session entry runs `libexec/cont8nuum-session`
(PATH, XDG_DATA_DIRS); `setup` (run as root after unpacking) links the
units, D-Bus services, font, portal config and SDDM theme into the
system's folders and copies the PAM, polkit, askpass, portal and udev
files a `/usr` install writes (from `share/cont8nuum/system/`, `etc/`
and `lib/udev/`); `setup --remove` undoes it. Not in it yet: XR (Monado) and the wallet (oo7). A
new distribution needs its own `DISTRO.txt` (`ID-VERSION_ID`, or `ID`
alone for a rolling one: `opensuse-tumbleweed`).

The distribution packages ("OBS style" on our own spindle: built once
per distribution, in that distribution's image, since names and
library versions differ even between RPM distributions). Ubuntu's come
after its tarball in `build.yml`'s run, `build-debian-13.yml` makes
Debian's debs (no tarball: `.tangled/build.sh` only makes one where
the image has wlroots 0.20); `build-fedora-45.yml` and
`build-opensuse-tumbleweed.yml` build the RPMs in
`localhost/c8-ci:DISTRO` (`.tangled/image/Containerfile.DISTRO`, by
`pkgconfig(...)` name, which dnf and zypper both take; `image-DISTRO.yml`
builds each, by hand). `.tangled/build.sh` picks by whether there's
`dpkg-deb`. `packaging/stage.sh` (sourced by both makers) builds for
`/usr` with `build.sh --prefix /usr --stage DIR` (each component
installed under `DIR/COMPONENT` by DESTDIR, the later ones built
against those through rewritten copies of their `.pc` files and
LD_LIBRARY_PATH, in their own `build-stage/` dirs, made afresh) and
sorts the result into a tree per package: `cont8nuum` (the desktop's
components), `cont8nuum-dev` (headers, `.pc`, the protocols),
`cont8nuum-lua` (toolkit/lua and apps/lua), `cont8nuum-APP` for each
app, which needs `cont8nuum` of the same version. `deb/make-debs.sh`
packs them with `dpkg-deb` (no debhelper; dependencies from
`dpkg-shlibdeps --ignore-missing-info`, ours having no shlibs);
`rpm/make-rpms.sh` writes a spec whose subpackages take the trees as
they are (`%files` lists generated: files, `/etc` as
`%config(noreplace)`, and only our own folders as `%dir`) and lets
rpmbuild find library dependencies. Both add `packaging/distro/DISTRO.txt`
(required/recommended); make-rpms checks every name against the
repositories first (Fedora has no `gvfs-archive`: gvfs is built without
its archive backend there, so Files can't look into archives on Fedora).
Version: the last tag (0.0 for now) `+gitDATE.COMMIT`, then
`-1+ubuntu26.04` / `-1+debian13` (deb) or `-1.fc45` / `-1.opensuse.tumbleweed` (rpm), so
the file name says the distribution; no tildes (artifact names can't
have them). The user's rule for libraries newer than a distribution has:
use the distribution's copy whenever it's at least the version we need.
`packaging/private-libs.sh` asks pkg-config (with `/usr/local` left out
of its path: the Ubuntu image's builds there are the tarball's) and
builds only what's missing or too old (Ubuntu: wlroots 0.20, gexiv2
0.16, at the image's pinned tags; Debian 13 also wayland,
wayland-protocols (build only), libdrm, xkbcommon, pixman, and for
Photos glycin 2 (2.0.8: Debian's Rust is 1.85, 2.2 wants 1.93; its
loaders in our folder, their configs in `/usr/share/glycin-loaders/2+`,
the only place glycin looks, beside Debian's own `1+`; not its
thumbnailer entries, which would be every file manager's) and gexiv2) into
`/usr/LIBDIR/cont8nuum`, found by an rpath, in the package of the
component that needs it, its headers and `.pc` not shipped (RPMs
neither provide nor require them). They keep their real names, not
renamed "Steam style": Mesa loads the system's wayland and libdrm by
soname, so renamed copies would put two of each in a process; with
the same names the one already loaded, ours, serves both (the user's
choice, 2026-12-06). Traps: wayland-protocols' `.pc` has no Cflags, so
wlroots' `<wayland-protocols/...-enum.h>` came from the system's older
copy (undeclared names) until private-libs.sh added one; wlroots'
pixman renderer needs pixman 0.46, more than its top-level 0.43;
wayland-protocols is pinned at 1.47, since 1.50 renamed an error of
color-representation that wlroots 0.20.2 uses; the images drop apt's
lists, so make-debs runs `apt-get update` itself (on Ubuntu the
tarball's script did it first, so Debian found nothing). A
distribution that can't have an app says `skip-app NAME` in its
DISTRO.txt (none does now; Debian 13 skipped Photos until glycin was
built). Photos includes `<glycin.h>`, as glycin's `.pc` means
(`<glycin-2/glycin.h>` only worked where it is in `/usr/include`). News builds on
libxml2 before 2.14 (Debian's 2.12), which lacks `XML_PARSE_NO_XXE`. The Debian image builds the private libraries once, in
`/opt/c8-private` (`image-debian-13.yml` passes `CONTEXT: .`, the image
job's optional build context, so it can copy private-libs.sh), and a
run takes each from there (`C8_PRIVATE_CACHE`) while its pin, and the
pins built before it, are the same; rebuild the image after changing a
pin, or that run builds them all. test-debs also upgrades to the
distribution as it is that day and, where there are private libraries,
fails if the distribution's copy of one is newer than ours (raise the
pin) or if any Mesa library (GL, EGL, GBM, Vulkan drivers) has a symbol
missing with ours in place of the distribution's (`ldd -r`, against
the distribution's own result): c8 loads ours first, so Mesa gets them
too. Debian 13, 2026-12-06: Mesa 25.0.7, 14 libraries, nothing missing.
It runs only with a build; nothing yet rebuilds when Debian updates
Mesa between pushes. `deb/test-debs.sh` and
`rpm/test-rpms.sh` (in a container only) install the packages with
apt, dnf or zypper, `/usr/local`'s libraries moved away, and `ldd`
every ELF. Tested on the spindle 2026-12-06 (by hand, in the images):
Ubuntu's 11 debs, Debian 13's 11, Fedora 45's and Tumbleweed's 11 RPMs
each built, installed and found everything. Rootless podman there has no cpuset controller
(`--cpuset-cpus` fails): `taskset -c 0-7 podman ...` instead. Not yet:
running an installed session (on Debian, our wayland and libdrm under
Mesa above all), upgrades, the portable tarball.

The signed repository, pkg.lowtide.sbs (2026-12-06), is on the spindle's server,
apart from CI: `c8pkg-publish.timer` (every 10 minutes) copies new
packages out of Laminar's archive of the cont8nuum job (as root, the
archive being laminar's alone), then as the user `c8pkg`, the only
holder of the key, signs the RPMs, files each by the distribution its
name says (`+debian13` → `deb/` suite `debian13`; release `1.fc45` →
`rpm/fc45/`), keeps the last 3 builds, and writes and signs the apt
(`InRelease`) and dnf/zypper (`repomd.xml.asc`) indexes, with
`deb/SUITE.sources` (the key inline) and `rpm/DIST/cont8nuum.repo`. A
new distribution needs nothing there. Key: RSA 4096, `cont8nuum
packages <lowtide.sbs@posteo.pm>`, 207C 85FD AEB0 6F40 AE03 743B 5C15
E22E 3986 EF9E, until 2031-12-05; its secret's only copy elsewhere is
in the user's oo7 (`service=pkg.lowtide.sbs`). Only from successful
runs (Laminar keeps artifacts of no others), and every push's for now.
The server scripts are in `~/Code/knot-svfe/pkg/` (not this repo).
Tested: a Debian 13 container added it and installed Photos through
apt with the signature checked; RPM signing and dnf/zypper not yet.

## Testing headless

- Test headless without touching the real config: `WLR_BACKENDS=headless
  WLR_RENDERER=pixman c8 -c SOMEDIR` with `XDG_CONFIG_HOME` pointed at a
  scratch dir; `grim` takes screenshots of it and `wtype` presses keys
  (Alt+Tab: `wtype -M alt -k Tab -s 2500 -m alt`). Headless there is no
  real keyboard: every `wtype` run adds and removes a virtual one, so
  the seat's keyboard capability flaps and c8ui clients let go of their
  `wl_keyboard` in between; a key sent before they bind it again is
  lost. Put a whole sequence in one `wtype` call (`-s MS` between keys).
- An app started with `c8 -s` before the shell has no keyboard focus
  until Super is pressed twice. `wlrctl pointer move` into a screen
  corner brings up the shell's panels, which eat the next click; move
  relatively and keep track. `move -5000 0; move 300 0; move 0 -5000`
  leaves it at (300, 0), not (0, 0): count from there (a miscount sent
  clicks 300 px off and looked like a dead list, 2026-12-01). `wlrctl` can't hold a button.
- Programs in `.prefix/bin` load c8ui from `/usr/local` when it's
  installed (no rpath): give a test `LD_LIBRARY_PATH=$PWD/.prefix/lib64`
  when a c8ui change is what's being tested.
- The nested c8's socket needs a short `TMPDIR` (108 characters). Test
  clients that own bus names go under `dbus-run-session`, so they don't
  take the real session's.
- XR tests must set `XDG_STATE_HOME` to a scratch dir (c8 writes the
  gyro bias and placements there); more in `compositor/XR.md`.
- Never `loginctl lock-session`; the nested shell still talks to the
  real system bus (NM, logind), so don't click Connect, Disconnect or
  Airplane mode there.

## Plans / open threads

- The shell split is ported (plan: `~/.claude/plans/eager-gliding-milner.md`);
  it runs as the real session. Keyboard paths of panels (Escape, Alt+Tab release)
  are untested headless.
- Not done yet from the DE list: an on-screen keyboard (a friend of
  the user's is writing one; don't start it). Untested live:
  pairing through the agent, the new protocols. Confirmed by the user
  in the real session (2026-12-04): Sound's per-app sliders, unlocking,
  connecting to Wi-Fi from the flyout.
- VR games through xrizer: paused 2026-12-03, where it stands and what's
  next in `compositor/MONADO-XR.md` (the xrizer item).
- Ideas: Bluetooth page on c8ui (BlueZ D-Bus).
- App ideas (staples, useful, fun) are in `docs/APPS-TODO.md`.

## Conventions

- Tabs, kernel-ish C style, short comments that explain why, written in
  plain words (UI text too: Windows 8 tone, sentence case).
- Every app is responsive: snapped to a quarter of the screen (~474
  px) it must still be fully usable, as one column like a phone app
  (one pane at a time, lists before details, a back button between,
  small margins, nothing cut off or running off the edge). Build each
  page once and let it reflow (the narrow setters in `toolkit/c8ui/CLAUDE.md`;
  see `toolkit/c8ui/template`): building wide and narrow apart is a design
  mistake, and `c8ui_root_on_resize` is for sizes only. Test every page at 480 wide as well as wide
  (headless: `[output HEADLESS-1] mode = 480x900` in the scratch
  config.ini). New toolkit widgets must fit narrow widths too.
- Commit only when the user asks. Every commit is lowtide's
  (`lowtide <lowtide.sbs@posteo.pm>`, in each repo's config, also the
  Monado fork's and the site's) and dated in UTC: a local offset says
  where the author lives. Git only knows `$TZ`, so Claude's sessions
  here run with `TZ=UTC` (`.claude/settings.local.json`), and
  `.githooks/post-commit` (`core.hooksPath`) re-dates any other commit.
  Mid rebase or cherry-pick git won't let the hook amend: run those
  with `TZ=UTC`, or `.githooks/utc-restamp BASE` afterwards.
  Upstream's commits (Monado's) keep their own author dates.

## Compact instructions

When compacting, keep: the task and what the user said about it in
their words, decisions made and why, each file changed and what
changed in it, what was built and tested and how (the exact headless
commands that worked), what failed, and what is still to do. Say which
component `CLAUDE.md` files (and `compositor/XR.md`) were in use: they
are dropped by compaction and come back only when a file beside them
is read again, so read them again before going on. Drop file dumps,
build output and screenshots already acted on.
