diff options
| author | user <user@clank> | 2026-08-16 15:05:02 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-16 15:05:02 +0200 |
| commit | ab8165a9717b4dd2b6dc750f504d4f67f6d9fdc6 (patch) | |
| tree | aca329fd1453a0739d714bcd190cd155780dd0ee /docs | |
| parent | sl0ppty: a prompt with a memory (diff) | |
| download | slosh-ab8165a9717b4dd2b6dc750f504d4f67f6d9fdc6.tar.gz slosh-ab8165a9717b4dd2b6dc750f504d4f67f6d9fdc6.tar.xz slosh-ab8165a9717b4dd2b6dc750f504d4f67f6d9fdc6.zip | |
sl0ppty: three ways back from a painted pane
printf '\033]5577;1;shader;\033\\' # from the program
sl0ppty cmd '{"cmd":"clear-shaders","id":0}' # from outside it
bind "z" "clear-shaders" # from the keyboard
`app_clear_pane_shaders` empties both of a pane's chains and says whether
there was anything there, which is what lets a key answer "shaders cleared"
or "no shaders on this pane" instead of maybe having done something.
In-band it is not a new verb: naming no rect means all of them. `shader;`
sits under `shader;chrome;` and `shader;content;` as the degenerate case of
"which rect", so a program puts a pane back in one exchange and cannot leave
it half done. `contrib/shader-repl`'s `:both` now uses that rather than two.
**None of the three is gated on `in_band_shaders`.** A chain outlives the
setting that allowed it -- paint a pane, then turn the setting off, and the
paint is still there, because a chain belongs to the pane and not to the file
(there is a test that reloads with it off and clears anyway). A way out that
the setting can take away is not a way out. The operator path matters for the
same reason: the program that made a pane unreadable is not always in a state
to put it back.
They clear what the *pane* set. The config's chains and the session's own
dimming are not this pane's doing and are derived every frame anyway.
The action is bound to nothing, like `scroll-up`: it is in the palette, which
is what the palette is for, and the docs say to bind it if you leave the
setting on. Which is where a second bug turned up -- the palette truncates a
label at 26 characters, so "undo this pane's own shaders" read as "undo this
pane's own shade" on screen. Renamed to fit, and `tests/test_palette.py` now
checks every label against the column, since nothing failed for that: it just
looked like a typo in front of someone.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/keys.md | 7 | ||||
| -rw-r--r-- | docs/scripting.md | 6 | ||||
| -rw-r--r-- | docs/shaders.md | 17 |
3 files changed, 26 insertions, 4 deletions
diff --git a/docs/keys.md b/docs/keys.md index 66163b5..a5befad 100644 --- a/docs/keys.md +++ b/docs/keys.md @@ -95,7 +95,7 @@ being bound at all. | group | actions | |---|---| -| panes | `split-cols` `split-rows` `close-pane` `rerun` `zoom` `minimize` `rotate-layout` | +| panes | `split-cols` `split-rows` `close-pane` `rerun` `zoom` `minimize` `rotate-layout` `clear-shaders` | | focus | `focus-left` `focus-right` `focus-up` `focus-down` `focus-next` `finder` | | size | `resize-left` `resize-right` `resize-up` `resize-down` `equalize` | | tabs | `new-tab` `next-tab` `prev-tab` `select-tab-1` … `select-tab-9` | @@ -103,4 +103,7 @@ being bound at all. | session | `palette` `help` `edit-config` `detach` `quit` `literal-prefix` | `scroll-up` and `scroll-down` have no default key — the wheel does that job — -which is exactly the case the palette exists for. +which is exactly the case the palette exists for. So does `clear-shaders`, which +undoes whatever the program in a pane painted on it +([shaders](shaders.md#prototyping-in-a-pane)); bind it if you leave +`in_band_shaders` on. diff --git a/docs/scripting.md b/docs/scripting.md index 298ae17..0f398ff 100644 --- a/docs/scripting.md +++ b/docs/scripting.md @@ -29,6 +29,7 @@ Panes and tabs are addressed by **id**, so a background tab is scriptable. | `split` | `dir:"cols"\|"rows"`, `id` for which pane to split | | `focus` | `id` | | `close` `rerun` | `id`, or 0 for the focused pane | +| `clear-shaders` | `id`, or 0 for the focused pane; answers `cleared:0\|1` — the way back from a pane that painted itself unreadable | | `new-tab` `select-tab` `close-tab` `move-tab` `set-name` | tabs, by `id` or `index` | | `set-purpose` | `target:"pane"\|"tab"`, `id`, `purpose` | | `dump-layout` `apply-layout` | see [layouts](layouts.md) | @@ -61,7 +62,10 @@ declared by a layout or the control API wins and cannot be overwritten this way. `shader` is the third, and the only one the session can refuse: it sets the shader chain for the pane that asked, in the config's own syntax, and needs `in_band_shaders true` because a program restyling your session is a hazard -before it is a convenience. See [shaders](shaders.md#prototyping-in-a-pane). +before it is a convenience. `shader;` with no rect named clears both of that +pane's chains, which is never refused -- and `clear-shaders` above is the same +thing from outside, for a program that will not do it itself. +See [shaders](shaders.md#prototyping-in-a-pane). Anything the session sends *back* to a program ends its verb in `-reply` -- `hello-reply`, `shader-reply` -- and no request verb may. A pane that echoes what diff --git a/docs/shaders.md b/docs/shaders.md index 63801db..bb0221d 100644 --- a/docs/shaders.md +++ b/docs/shaders.md @@ -96,7 +96,8 @@ set the chains for the pane it is running in, in the same syntax the config uses ```bash printf '\033]5577;1;shader;chrome;tint color="#ff5fd7" amount="abs(t / 8 %% 510 - 255)"\033\\' printf '\033]5577;1;shader;content;dim amount=90\033\\' -printf '\033]5577;1;shader;chrome;\033\\' # nothing: back to normal +printf '\033]5577;1;shader;chrome;\033\\' # that rect: back to normal +printf '\033]5577;1;shader;\033\\' # no rect named, so both of them ``` The field after `shader` is which rect (`content` or `chrome`), and the rest of @@ -105,6 +106,20 @@ on one line. The session answers on the program's stdin, `\033]5577;1;shader-rep or `shader-reply;error;bad amount for tint: ...`, so a typo says so instead of looking like a shader that does nothing. +**Three ways to take it all back**, because the program that painted a pane is +not always in a state to put it back: + +| | | +|---|---| +| `printf '\033]5577;1;shader;\033\\'` | from the program, one exchange, both rects | +| `sl0ppty cmd '{"cmd":"clear-shaders","id":3}'` | from outside; `id` 0 or absent means the focused pane | +| the `clear-shaders` action | on a key you bind, or from the palette | + +None of them is gated on `in_band_shaders`. A chain can outlive the setting that +allowed it -- paint a pane, then turn the setting off -- and a way out that the +setting can take away is not one. They clear what the *pane* set: the config's own +chains and the session's own dimming are not this pane's doing. + `contrib/shader-repl` is that loop with a prompt on it: type a chain, see the pane change, and `:paste` prints what you have as a `shaders { }` block for your config. What you prototype and what you paste are parsed by the same code, which |
