# c8-base

- c8-base (`toolkit/c8ui/base/`, linked statically, so every program carries its
  copy and nothing new is needed at run time): `json.h` (the small JSON
  reader, `json_dump` too; `json_at` and `json_length` walk the list, so
  loop over `->child`/`->next` for anything long; freeing a tree of
  `TRIM_NODES` or more calls `malloc_trim`, since what the caller kept
  sits among the freed nodes and glibc held on to it all: Weather's tile
  provider stayed at 49 MB after parsing 2 MB of alerts; glibc only,
  so c8ui builds on musl: tested building and running on Alpine 3.24), `clock.h` (the 12/24 h format), `rfkill.h`,
  `http.h` (`c8_http`: curl as a subprocess with the request on stdin,
  https only unless `allow_http`, downloads through `dest.part`,
  `upload` + `content_type` send a file's bytes as the body; Weather's
  and Tile maker's `http.c` are wrappers; News, c8-accounts and c8-sync
  still have runners of their own), `tiles.h` (`c8_tiles_call` for
  org.cont8nuum.Tiles1, and `c8_tile_provider_watch`: when a provider
  quits, i.e. Restarting for its tile, unpinned if `quit_unpinned`, the
  shell gone 60 s, SIGTERM; News, Weather and Tailscale providers use
  it, `c8-widget` still has its own), `default-apps.h` (the kinds, for
  the shell and PC settings) and `power-profiles.h` (the modes' names
  and `c8_power_profile_offered`), `stealth.h` (stealth mode, below), `background.h` (where the
  Start and lock screen pictures Photos sets are:
  `$XDG_DATA_HOME/cont8nuum/{start,lock}-background.jpg`; only
  c8-settings may write config.ini, so a picture is a file Photos
  writes by rename and the shell watches, and PC settings removes). The headers are included by bare
  name (`#include "json.h"`), so no component may have a file of its
  own called one of those.

Stealth mode (`stealth.h`, `[stealth] on` in config.ini, PC settings'
General page): for screenshots and recordings, whatever names the user
or the machine is drawn as a made-up stand-in. Only what's shown
changes: PAM logins, connections, requests and saved files keep the
real values, and an editable box showing a stand-in is disabled (the
real value kept to save), so a fake is never written back. The persona
is `[stealth] name`/`login`/`host`/`email`/`handle` (default lowtide,
lowtide-pc, lowtide@example.com, lowtide.example.com); `c8_stealth_text`
replaces the real home, host, name and login as whole words;
`c8_stealth_alias` gives networks, devices, places, people and
addresses (documentation ranges) a stand-in kept for the program's life.
A program on a GLib loop calls `c8_stealth_watch` (a GFileMonitor on
config.ini's folder; it checks both `file` and `other`, since editors
and `setting_set` save by rename) and draws again from it; the
compositor, which watches config.ini itself, calls `c8_stealth_reload`
from its reload instead. `c8_stealth_config_dir` first for programs
with `--config`. Where each component applies it is in its own notes.
Tested headless: Start's name and picture, PC info, Network, the
General page's toggle writing `on` and flipping Start live. Untested:
lock, askpass, polkit, the real session.
