aboutsummaryrefslogtreecommitdiffstats
path: root/docs/layouts.md
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-15 23:53:30 +0200
committeruser <user@clank>2026-08-15 23:53:30 +0200
commit4dc055692c56324a94d1087331da8862ea650d2b (patch)
tree5ddec99f7cf6b144ede4138b6e952c84379725aa /docs/layouts.md
parentsl0ppty: marks a font actually draws at cell size (diff)
downloadslosh-4dc055692c56324a94d1087331da8862ea650d2b.tar.gz
slosh-4dc055692c56324a94d1087331da8862ea650d2b.tar.xz
slosh-4dc055692c56324a94d1087331da8862ea650d2b.zip
sl0ppty: a README you can read, and docs/ for the rest
The README was 331 lines and had become a manual with a title. Everything in it was true and most of it was the wrong thing to hand somebody who has just arrived: five pages of shader expression semantics before they have split a pane. So the front page is 60 lines -- what it is, install, run, where the docs are, and six bullets on what is actually different about it -- and the detail moved into docs/, nine pages that each answer one question: index.md what it is, install, run, where to go keys.md the leader, every default, rebinding, direct binds panes.md splitting, resizing, the mouse, dead panes, small terminals config.md the file, live reload, include, themes, the knobs shaders.md the passes, the built-ins, the expression language chrome.md where="chrome", channel, since, the perimeter trick layouts.md a session as a file, and writing one back out scripting.md the control socket, OSC 5577, headless design.md the two decisions, and a map of the source docs/nav holds the order and the grouping and nothing else -- titles come from each page's own heading, so a renamed page cannot end up with two names. It is what the site generator will read. Reference material that only existed in code comments is written down for the first time: every action that can be bound (including the two with no default key, which is what the palette is for), every control verb, the built-in shaders with what each takes, the pane-state ranking, and the layout file's shape. Two things I got wrong on the first pass and fixed before committing: the docs linked repo files through github.com URLs for a project whose remote is a private git server, so those are inline paths now; and the README advertised `make docs`, which does not exist yet. It will in the next commit, and it can be advertised then.
Diffstat (limited to 'docs/layouts.md')
-rw-r--r--docs/layouts.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/docs/layouts.md b/docs/layouts.md
new file mode 100644
index 0000000..36029ab
--- /dev/null
+++ b/docs/layouts.md
@@ -0,0 +1,75 @@
+# Layouts
+
+A session can be a file, so a project's window layout is checked in with the
+project.
+
+```kdl
+layout {
+ tab name="api" cwd="~/dev/api" {
+ pane command="nvim"
+ pane split="rows" {
+ pane command="npm run dev" suspended=true
+ pane
+ }
+ }
+}
+```
+
+```bash
+sl0ppty --layout session.kdl
+```
+
+## The shape
+
+- `tab` — one per tab, in strip order. `name=`, `cwd=`, `purpose=`,
+ `active=true` for the one you land in.
+- `pane` — a leaf, or a split when it has `pane` children. `split="cols"|"rows"`
+ says which way it divides; `weight=` is its share of the parent (even shares
+ are equal weights, so leaving it out means "even").
+- `command=` — what it runs. Without one, a pane runs your shell.
+- `cwd=` — where it starts. Inherited from the tab when the pane does not say.
+- `suspended=true` — laid out but running nothing until you touch it, so twelve
+ checked-out projects are not twelve running dev servers. The pane shows what it
+ *would* run.
+- `focus=true` — the pane you start in, within its tab.
+- `purpose=` — a label for tooling; see below.
+
+A full annotated example is
+`config/layout.example.kdl`.
+
+## Writing one back out
+
+```bash
+sl0ppty -s work cmd '{"cmd":"dump-layout"}'
+```
+
+writes the session as a layout file: tabs, splits, proportions, directories,
+commands, which pane you were in. So a session can be checked in, or put back
+after a restart.
+`contrib/sl0ppty-dev`
+is that loop, for when the thing you are rebuilding is sl0ppty itself.
+
+What a dump can honestly restore is the *shape*. What it cannot is the state
+inside a program — a shell's history, a running editor — and it does not pretend
+otherwise. A pane running the session's default shell is dumped as a pane with no
+command, so restoring gives you a fresh one.
+
+## Applying one to a running session
+
+```bash
+sl0ppty -s work cmd '{"cmd":"apply-layout","path":"session.kdl"}'
+sl0ppty -s work cmd '{"cmd":"apply-layout","kdl":"layout { tab { pane } }","replace":true}'
+```
+
+Without `replace`, the tabs the file describes are added to what is already
+there.
+
+## Purposes
+
+A pane or tab can carry a `purpose=` label — `agent:main`, `logs`, `db` — for
+tooling to find it by. A purpose declared in a layout or over the control API is
+*locked*: a program inside the pane cannot overwrite it, so identity comes from
+the layout rather than from whatever the program decides to print.
+
+The [finder](panes.md#finding-a-pane) matches on purposes as well as titles, and
+`{"cmd":"panes"}` reports them.