diff options
| author | user <user@clank> | 2026-08-25 14:23:33 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-25 14:23:33 +0200 |
| commit | b744a90859bf248bfbea97f990668301b5fa9537 (patch) | |
| tree | f1b717507bc24161b7ab41def644289f9457470e /DESIGN.md | |
| parent | placeholder webbie (diff) | |
| download | slosh-b744a90859bf248bfbea97f990668301b5fa9537.tar.gz slosh-b744a90859bf248bfbea97f990668301b5fa9537.tar.xz slosh-b744a90859bf248bfbea97f990668301b5fa9537.zip | |
compact: shared borders instead of gaps (D23)
One knob, `compact true`: panes pack flush against 1-cell divider lines
that meet in real junctions, one frame rings the tab, and a pane's title
rides the line above it -- a boundary costs one cell where the default
look spends four. The lines are strokes: each write says which edges of
its cell it needs, unions with what is there, and never clobbers text,
so ├ ┬ ┼ fall out of paint order and the focus ring recolours without
inventing arms. The divider *is* the gap (eff_gap, one answer for the
layout, split_fits and the resize clamp), so gap hits, hover hints and
corner drags work unchanged. Interior edges give up click-to-split --
one cell cannot hold two verbs -- and a pane's status row overlays its
last content row. Floats, zoom and the D6 flatten keep classic frames
through place_hidden: zero new tree cases.
Underneath it, mode or no mode: a border drag now moves the boundary on
that side, converted on the first motion so the press that never moves
keeps its old meaning -- the handle's click still splits, the rim's is
still deliberately nothing (drag.rim). Which is also the fix for gap 0,
where flush panes leave no gap cell to grab and the resize gesture had
silently vanished with it.
Diffstat (limited to 'DESIGN.md')
| -rw-r--r-- | DESIGN.md | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -165,6 +165,7 @@ unreadable. | **D20** | **Chrome is a rect too, so it is a pass too.** `where="chrome"` on any entry in `shaders` or in a `states` block runs that pass over a pane's **frame** — border, padding, title, buttons — instead of its contents. Nothing else changes: same registry, same `amount`, same expressions (D16), same chain order, one new word. It is one pass over the frame's *whole* rect with the contents punched out as a hole, not four passes over four sides: an effect has to be able to travel round a border, and four passes would each count `x`/`y` from zero and restart at every corner. The hole is what keeps the two honest — a skipped cell is never visited, so a full-strength chrome tint cannot reach your text and a full-strength content tint cannot reach the border. The chains are stored separately rather than as a flag on each shader, because a pass *is* a chain and a rect, and because `shader_abi.h` has no business knowing where a session chose to run an effect. This is also the only kind of pass that can colour a pane a small window has collapsed to a single row (D6), which is the state where a colour is worth the most. **Animation needs a clock**, so `app_next_deadline_ms` reports one while a chain that reads `t` ran over the last frame — derived from what was applied, like everything else about a frame, so a pulse hung off `dead` costs `anim_ms` while a pane is dead and nothing for the rest of the session. Without it a border froze the moment you stopped typing, which is the bug that makes an animated shader look broken rather than absent. A **`bell` pane state** and a **`since`** variable came with it, because "flash the border when a pane rings" needed both and neither existed: a bell had no state to hang a chain off, and `t` says what time it is rather than how long ago something happened, so a one-shot effect was not expressible at all. `since` is milliseconds since the pane entered its current state, stamped in the one function that decides the state — a transition is the one thing a frame cannot tell you, so it is remembered, but it is remembered where it cannot disagree with the state it dates. `bell` ranks above the ambient states and below `dead`: a pane that rang while you were elsewhere is news, and a pane that rang and then exited is a pane that exited. It ends when you look at the pane, because that is what answering a bell is (the frame clock stops with it). **Shipped on by default**: the compiled-in `bell` state is two tints in theme's `bell` colour whose amounts read `since` — on the frame, three full-strength blinks over the first 900ms and then a slow breathe; on the body, a quiet shimmer — one soft diagonal sheen gliding across, peak strength 95 against the blinks' 255, its colour softened halfway towards `default_fg` (light, not paint), its width breathing on a sine as it travels, gone within those same 900ms — so what you are reading is only touched, gently, while the announcement lasts. Derived after the theme block the way the scrolled wash is, so a theme moves the mark, the flash and the shimmer together. The original objection was that an animated default would spend a frame clock on every session, and the clock's own derivation is what answers it: `since` carries `EXPR_DEP_TIME`, so the `anim_ms` clock runs only while a rung, unanswered pane is actually on screen — an idle session pays nothing. It follows `bell_indicator false` off (that knob's promise is silent *and* invisible), and `states { bell { … } }` — including an empty one — replaces it like any state, tracked across includes like `scrolled`. **`channel="fg"|"bg"|"both"`** came from the first border flash actually being looked at: `tint` mixes both of a cell's colours, and a frame's background is the terminal's own default, so the pass materialised it to our *guess* at that default and mixed towards the colour — a dark rectangle behind the glyphs, left there until the pane changed state. The mask is enforced by the pass, not by the shader: the cell's other colour is snapshotted before materialising and put back after, so it works for a built-in and a plugin alike, an unset colour goes back to *unset* rather than to our guess, and no shader grows an fg-only variant of itself. It is one byte tested once per pass, not per cell, and 0 means both so every shader built before it behaves as it did. | | **D21** | **A project is a directory; a workspace is the tab it occupies.** Two words because they are two things, and conflating them is how a session grows a second source of truth about what it is looking at. The directory is found rather than named: a `project_roots "~/dev" "~/work" depth=2` is scanned for subdirectories holding a `slosh.layout` — or a `.git`, which is the project that has not said what it needs yet, and without which `~/dev` with forty checkouts and three layout files is a picker with three rows. A directory that *is* a project is never descended into, so the walk stays off `node_modules` without anyone writing a rule about `node_modules`. **Identity is the tab's `purpose`**, `project:<name>.<hash8>` of the resolved path — the shape D3 already published — so there is no second field to disagree with it, membership is a string comparison, and a dumped session restores it for free because a dump already writes tab purposes and applying one already locks them (D8). Hashed on the *path* rather than the name, so two worktrees of one repo are two workspaces, which is what they are. A tab whose layout gave it a purpose of its own keeps it and is simply not a member: overwriting a declared purpose is the one thing D8 forbids, and the reply counts the ones it left alone rather than letting that be a surprise later. **Nothing watches the filesystem.** The list is derived when it is asked for — one `readdir` per root and two `stat`s per entry, forty checkouts for eighty-one syscalls next to the keystroke that asked — and an answer nobody remembered cannot be stale, which is a promise no watcher can make on a bind mount. The picker scans once as it opens, not per frame, because `draw_picker` asks for its rows every frame and a `readdir` per repaint is a filesystem walk at 120Hz. The one thing a scan cannot see is a project's layout file changing under a workspace that is already open, and that is deliberately not answered by re-applying it over running processes: `workspaces` reports the file's `mtime`, and drift is derivable outside without this session storing a byte. **Opening is idempotent** (`sl0ppi up`'s property, D3): the same request twice is one workspace, focused, and the answer says which branch it took so a caller never has to ask first. **Saving is the inverse, and it is the whole of onboarding.** `save-workspace` is `dump-layout` for one tab, relative to the project, written beside it — the same dumper, so there is one answer to "what does this tab look like written down". Four things made that possible and none of them were true before: a relative `cwd=` in a layout file now resolves against that file's directory (the rule `include` already followed, applied to the other half of the same syntax), a dump can be asked for one tab against a base, a pane from a split now starts where the pane it came out of stands rather than where the server was launched — which had been quietly writing an absolute path to somebody else's directory into every saved project — and **a dump now records what a pane is actually running**. That last one is what turns arranging a project and writing it down into one act instead of two: `label` only ever knew what a *layout* said, so a pane you split and typed `npm run dev` into had nothing to say for itself and came back as a bare shell. The kernel knows what the label does not — a pty has a foreground process group, and that group is by definition the job that owns the terminal — so the answer is read rather than guessed, the way `live_cwd` already reads `/proc/PID/cwd` rather than trusting where a pane was started. Three things are deliberately not commands: a shell at a prompt (its group is the pane's own, and `command="zsh"` on every idle pane restores a session where each shell runs inside a shell), a background job (it does not own the terminal, and resurrecting `&` jobs in the foreground describes a session nobody had), and an ephemeral pane (restoring one reopens a file somebody finished with). A declared label still outranks a live process, because it survives the program exiting (D14) and re-saving must not degrade `npm run dev` into whatever the process tree looks like this minute. argv is joined with shell quoting, since `command=` is run through `/bin/sh -c` and an argument with a space in it would otherwise come back as two. A saved project defaults to `suspend="commands"`: the pane running this morning's dev server is written asleep, because a *project's* layout is a statement of shape and a *session's* dump is a statement of fact, and starting a dev server on every open is exactly what `suspended` exists to prevent — which is worth much more now that there are commands to suspend. What is **not** built: no guessing commands from `package.json` or `Cargo.toml` (a table of guesses that is wrong on day one and stale by year two — recording what you actually ran makes it unnecessary), no watcher, and no auto-save on close, because a layout file is a commit-sized decision. | | **D22** | **A pane can float**: lifted out of the layout, drawn over the tiled panes and under the modals, freely moved and shaped. The model is a flag, a wanted rect and a raise stamp on the leaf — exactly the `minimized` pattern, not a second collection: the seat in the tree is kept, `layout()` skips it, the siblings absorb its share, and un-floating returns it home, so everything that walks leaves (the finder, `close_leaf`, the dump, the D6 flatten) works with zero new cases. **The drawn rect is derived, the wanted rect is remembered**: what is painted is the intent clamped into the tab every frame and the clamp never writes back, so a terminal squeeze round-trips exactly — the same lesson the weights taught — while an explicit move or resize *does* write the clamped answer back, because the hand is the author of the intent (and is refused while the tab is flattened or zoomed, where the shown rect is not a place to return to). A resize pins the **grabbed edge** at walls and floors and never moves the opposite one — the general clamp preserves size by sliding the rect, which turns "drag the right edge past the wall" into the window walking left — and which edges a grab holds is derived from where the press landed (`float_edges_at`), shared by the press, the hover hint and the guide, so a bottom corner is two edges with no corner target to register and the promise cannot disagree with the drag. **Floats paint after everything tiled and before the modals**, so the backwards-searched hit list makes the z-order and the click order the same list — the one-geometry commitment paying out as "no routing code to write" — and before the status line, which reads that list for its hover hint and must not hint a float's border as the pane underneath. Focusing a float raises it, stamped in `layout()` once rather than at each place focus can move. **Floating pops the pane to the centre**: the jump is what says the float happened — lifted in place it looks like a pane whose neighbours flinched — so position is the announcement and only the size is remembered. The shadow is what tells a float from a tile (the frame is the same frame): `float_shadow`, a number and not a state chain, for the `dim_unfocused` reason — turning it off must not require knowing the states block exists. A `floating` state joined the D13 table **above `unfocused`**, shipped empty: a float is never dimmed as merely-unfocused, because full strength is what keeps the thing on top reading as lifted (the `dragging` argument). Guards, all of one invariant — **an overlay needs a backdrop**: the last tiled pane cannot float or be minimised away, and closing it lands the top float (`ensure_tiled`, checked once per frame in `layout()` like the minimised-focus rule). A float's splits are refused through `split_fits`, which reaches the guide, the border click and the keyboard in one place; it is no swap target, because its tree seat is not where it is. The keys: `f` floats (what "float" sounds like; the finder moved to `s`, where it reads as *search*), `F` opens a **new floating shell** — the throwaway terminal, a real leaf beside the focused pane so un-floating lands it and D14's shell rule closes it — `H J K L` move a focused float, the `=`/`+` key grows it about its own centre and `-` shrinks it (its split was a refusal anyway); equalize moved to `0` because a legacy terminal reports `+` as a bare `=`, and two verbs on one key survive only until the shift is dropped. **The memory (M10c)**: a float survives being written down. `dump-layout` records `floating=true x= y= w= h=` — the *wanted* rect, because intent is what survives a session and the next screen's layout clamps it like any frame — layout files declare the same, and a file whose every pane floats self-heals through `ensure_tiled`, the invariant holding itself with no lint required. `float` over the API takes `x y w h` and then *places* rather than toggles — a placement is a statement about where, not about whether — with omitted fields meaning "keep", and the intent stored exactly as asked (the write-back rule is for hands, whose drags need the clamp to agree with the eye; a script means what it typed). And **kitty graphics respect the stack**: the cell compositor gets occlusion free from paint order, but placements are sent after the diff, so each pane's placements are clipped by the float rects above it — crop what one clean edge can express (the pane-edge source-rectangle arithmetic aimed at another clipper, including from the top and left, where the source origin moves), and suppress what it cannot: a float across the middle or on a corner leaves a shape one placement cannot say, and it returns when the float moves. No `z=` needed — clipping *is* the z-order, since nothing is ever allowed to overlap. | +| **D23** | **Compact mode: shared borders instead of gaps** (`compact true`). One knob, because the request is one idea: the boundary between two panes costs one cell instead of four (a border, a gap's two columns, a border) — on an 80×24 screen with four panes, the difference between 54% of the cells being content and 74%. Panes pack flush against 1-cell divider lines, one frame rings the whole tab, and a pane's title, buttons and scroll indicator ride the line *above* its rect — a line every pane has by construction, the ring for the top row and a divider for everyone else — so the tab strip and the status line give up their surrounding air too. The lines are drawn as **strokes**: a write says which of the cell's four edges it needs (up/down/left/right), unions with whatever line is already there, and never touches a cell holding anything that is not a line. So a divider running into the frame makes a ├ and two dividers crossing make a ┼ with nobody computing junctions; the focused pane's ring is *recoloured* by re-stroking — adding no arms of its own, because an arm the structure does not have is exactly what the minimised bar's rows must not grow — and a title drawn onto a line later simply wins its cells, the paint-order rule the hit list already lives by. The geometry underneath is the old geometry: the divider *is* the gap, one cell wide whichever axis (`eff_gap`, the one answer the layout, `split_fits` and the resize clamp all read), so the gap hits, the hover hints, the corner-finding and the corner drag work unchanged — the divider drags exactly as the gap did because it *is* the gap, with a line drawn through it. What compact costs, on purpose: **interior edges give up click-to-split** — a one-cell line cannot honestly hold two verbs, so the whole of it is the resize handle; the outer frame keeps its handles, the keyboard splits anything, and a pane whose title line is a shared divider is still dragged, by its name. And a pane's **status row overlays its last content row** — a dead pane's epitaph and its `[re-run] [close]`, a program's OSC 5577 row — there being no bottom border left to carry it, which is why draw_cb paints it after the pane composes rather than draw_frame before. The hover hint had to learn to ask (`edge_owns`): each dotted cell is painted only if the hit list still says the boundary owns it — the top-row furniture rule, applied to a line that now carries a neighbour's name — which is also why the hints moved to a pass after the panes, where the list is finished. Floats keep the classic frame — an overlay needs its own edge — and so do a zoomed pane and the D6 flatten, through the `place_hidden` paths the layout already had: compact adds zero new tree cases, the D22 property inherited rather than re-earned. Chrome passes (D20) run over the pane's ring of shared line, one cell out; a line between two panes belongs to both, so a chain that recolours an unfocused frame will touch the focused pane's stretch of a shared line — two owners is what sharing means, written down rather than papered over. | ### D6 — responsive layout as a pure function @@ -284,6 +285,10 @@ Frame pacing: pty reads are coalesced and painted on a timerfd at a cap - **M11** — the drop grammar: while a pane is carried, the pane under the pointer subdivides into a swap centre and four insert bands — dragging became re-layout (see the drag machine below) ✅ +- **M12** — compact mode (D23): shared 1-cell borders drawn as merging + strokes, titles riding the line above their pane — and, mode or no mode, + a border drag now moves the boundary on that side, which is what `gap 0` + had been missing ✅ ### The border is the button @@ -305,6 +310,19 @@ side carries a **handle**, three to seven cells of it, and only the handle splits. The rest of the edge — the *rim* — arms the guide and does nothing when clicked. +**All of it drags, though.** A border press that then *moves* becomes a drag +of the boundary on that side — converted on the first motion, so the press +that never moves keeps its old meaning: the handle's click still splits, the +rim's click is still deliberately nothing (`drag.rim` is what keeps it inert +on release). Which boundary is a walk up the tree (`boundary_for_side`), +because the pane's own parent may divide the other way and the boundary to +the right of a pane can belong to a split any number of levels up; a side on +the outer edge has nothing to drag against and drags nothing. This is also +the answer for `gap 0`: flush panes leave no gap cell for the resize hit to +live on — `gap_rect` truthfully reports no gap — so before this, choosing no +gap silently cost the mouse its resize. The border is all there is there, and +now it is enough. + Hovering therefore answers two questions in two stages, because they are two questions. **Anywhere on the edge**: the edge goes heavy and the handle goes solid **with the direction arrow knocked out of it**, which says *where the @@ -427,7 +445,8 @@ what is on screen: | target | painted by | drag does | |---|---|---| | a frame's top row | `draw_frame` | carry the pane: where it lands decides (the drop grammar, below) | -| the gap between two children | `draw_node`, from the rects they were just given | move that boundary | +| the gap between two children | `draw_node`, from the rects they were just given | move that boundary (compact's divider is this same gap with a line drawn through it, D23) | +| a side's border — handle or rim | `draw_frame` | move the boundary on that side; the press that never moves stays a click — the handle's splits, the rim's does nothing | | a tab in the strip | `draw_tab_strip` | move it to where you drop it | | ...and a *pane* dropped on a tab | `draw_tab_strip` again | move the pane into that tab; onto the `+`, into one of its own | | a floating pane's title / border | `draw_frame` | move / resize the float, its own verbs — everything a title or border drag means on release is what a float must not do (D22) | |
