diff options
| author | user <user@clank> | 2026-08-16 01:06:42 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-16 01:06:42 +0200 |
| commit | 3b9c1d987db7dae1db68a8ea304e8227344a1cdb (patch) | |
| tree | b2aa66a61e2111720115442611ca092d261c161c /config | |
| parent | sl0ppty: a reply is never a request (diff) | |
| download | slosh-3b9c1d987db7dae1db68a8ea304e8227344a1cdb.tar.gz slosh-3b9c1d987db7dae1db68a8ea304e8227344a1cdb.tar.xz slosh-3b9c1d987db7dae1db68a8ea304e8227344a1cdb.zip | |
sl0ppty: a pane can set its own shaders
printf '\033]5577;1;shader;chrome;tint color="#ff5fd7" amount="abs(t / 8 % 510 - 255)"\033\\'
The field after `shader` is which rect -- `content` or `chrome` -- and the
rest of the payload is a chain in exactly the syntax a `shaders { }` block
uses, taken verbatim so that `;` can go on separating entries. Empty text
clears that chain. The session answers on the program's stdin, `shader-reply;ok`
or `shader-reply;error;bad amount for tint: ...`, because a prototyping loop
that gets no answer cannot tell a typo from a build without the feature.
`contrib/shader-repl` is the prompt this exists for: type a chain, watch the
pane, and `:paste` prints what you have as a config block. Both ends are the
same parser, so what you arrive at is what you can keep -- verified by
pasting `:paste`'s output into a file, linting it, and checking the frame
comes out the same colour.
**D13 said this was impossible on purpose, and the reasoning stands**: a
program that can restyle the session it happens to be running in is a hazard,
and `cat hostile.txt` should not dim your panes. But *impossible* was the
wrong shape for it -- editing a file, saving, looking and guessing again is
slow enough that shaders go unwritten. So it takes `in_band_shaders true`,
one line of consent, and it is scoped to the pane that asked: its own two
chains, never its neighbour's, never what the config said about anyone else.
There is a test for the neighbour.
Each chain owns the programs its expressions compiled to, and is swapped in
whole, so a chain that turns out not to read leaves the pane looking like it
did rather than half-restyled. Measured: 1,800 replacements of an animated
chain, resident size flat after the first pass.
Also here, because it is the same paint order: the chrome chain now sits
between the config's and policy's, exactly where the content chain does.
Dead code out -- `app_shade_add`/`app_shade_clear`/`app_shade_count` had no
callers and their comment claimed the opposite of what this commit does.
Diffstat (limited to 'config')
| -rw-r--r-- | config/config.kdl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/config/config.kdl b/config/config.kdl index b0ff1f9..95611c6 100644 --- a/config/config.kdl +++ b/config/config.kdl @@ -251,6 +251,24 @@ status_pad 4 // expands a collapsed pane just because the pointer crossed its header. focus_follows_mouse true +// Whether the program running in a pane may set that pane's shader chains, by +// printing an escape sequence: +// +// printf '\033]5577;1;shader;chrome;tint color="#ff5fd7" amount=255\033\\' +// +// The payload after `chrome` (or `content`) is a chain in exactly the syntax the +// `shaders` block below uses, so a chain you arrive at this way is a line you can +// paste. `contrib/shader-repl` is a prompt that does it for you, and prints the +// block to paste when you like what you see. +// +// Off, because a program restyling the session it happens to be running in is a +// hazard and not a feature -- `cat` some hostile file and it can dim your panes. +// On, it is scoped to the pane that asked: it cannot touch another pane, and it +// cannot change anything this file said about everybody else. The pane is told +// `off` rather than ignored, so a program can tell "you said no" from "this +// build has never heard of it". +in_band_shaders false + // The floor below which a pane is not small but useless. A split that cannot // give every child this much collapses into a stack instead, with one pane // expanded and its siblings as one-row headers. Recomputed every frame, so |
