nandi/jolt-nativepublic Fork 0
6a3304ddddcc7d3e9486b470fea5933a1f81f8e8
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

README.md · 52 lines · 2.4 KBmarkdown Blame HistoryRaw
glimmer-cosmic: a libcosmic backend for glimmer (spike) 6a3304d nandi 8d ago1# glimmer-cosmic
2
3The **libcosmic** backend for glimmer — a spike. The same hiccup that
4[glimmer-vidya](../glimmer-vidya) paints with egui and [glimmer-tui](../glimmer-tui)
5paints in a terminal, painted with COSMIC's widgets and theme through
6[`crates/jolt-cosmic`](../../crates/jolt-cosmic).
7
8```bash
9cargo build --release -p jolt-cosmic
10LD_LIBRARY_PATH=../../target/release jolt counter
11LD_LIBRARY_PATH=../../target/release jolt smoke # non-interactive, quits itself
12```
13
14## What is the same
15
16The tree half is glimmer-vidya's. Nodes are integer handles in a Rust arena,
17props are written across by name, handlers stay on the jolt side and are found
18by node id when an event comes back, and a widget writes its new value into its
19own props so a control that ignores its event still works.
20
21## What is not: who owns the loop
22
23egui lets its caller drive frames. libcosmic does not: `cosmic::app::run` takes
24the main thread (winit insists) and keeps it until the window closes. So the
25loop is inverted:
26
27```
28main thread cosmic_run ──────────────────────────────────── returns on close
29 ▲ wake(tree) │ click / change / toggled
30worker (future) mount → commit → wait ─ drain, dispatch, timers → commit → wait …
31```
32
33* The reconciler runs on a worker, which is the "UI thread" as glimmer sees it:
34 `schedule` queues onto it, handlers and timers run on it.
35* Its edits land in the arena under a mutex, but libcosmic paints a snapshot
36 taken at `cosmic_tree_commit`, once per pass. A reconcile half-way through a
37 patch is never on screen, and a pass that changed nothing commits nothing.
38* The worker sleeps in `cosmic_wait` until there is an event, a `schedule`, a
39 due timer or a close — an idle window costs neither side anything.
40* Every call but `cosmic_run` is safe from any thread, which is not true of
41 libvidya.
42
43## Spike limits
44
45* Tags: `:window` `:box`/`:hbox`/`:vbox` `:page` `:card` `:frame` `:scroll`
46 `:label` `:title` `:title-2` `:dim-label` `:button` `:checkbutton` `:entry`
47 `:separator` `:spacer` `:progress`. Anything else paints as a column.
48* Events: `click`, `toggled`, `change`, `activate`.
49* One window per process — winit cannot make a second event loop — so there is
50 no REPL `start!`/`stop!` yet, and no headless test beyond the arena's own
51 Rust tests.
52* libcosmic is MPL-2.0 and a git dependency; see `crates/jolt-cosmic/Cargo.toml`.