diff options
| author | user <user@clank> | 2026-08-17 13:38:33 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-17 13:38:33 +0200 |
| commit | 7a91885c3b063c8d231daceb2b2e29e1f1a81aa6 (patch) | |
| tree | 7210a201bc59bd0c871cbc82afc21de16d3959b5 /docs/scripting.md | |
| parent | sl0ppty: a --script pane is told no session rather than somebody else's (diff) | |
| download | slosh-7a91885c3b063c8d231daceb2b2e29e1f1a81aa6.tar.gz slosh-7a91885c3b063c8d231daceb2b2e29e1f1a81aa6.tar.xz slosh-7a91885c3b063c8d231daceb2b2e29e1f1a81aa6.zip | |
sl0ppty: `set-name target="pane"`, so a script can overrule a program's title
A pane's name already outranks the title its program sets -- `pane_title` prefers
the name while there is one -- and that is the whole remedy for a program
announcing something it stopped meaning: an agent still spinning the summary of a
task it finished, a build script that titled itself once. The remedy was reachable
by double-clicking the title on somebody's screen, and from a layout file, but not
from the socket, while `set-purpose` next to it has taken `target:"pane"|"tab"` all
along.
`target` defaults to `tab`, which is what this verb has always meant. Two verbs
whose defaults differ is a smaller wrong than a verb that quietly changes its
subject under scripts already written against it. The refusals say `no such pane`
or `no such tab`, so a mistyped target shows up in the reply rather than as a label
that did not move.
The gesture now calls the same function, so the two ways in cannot disagree about
where a pane's name lives -- there is a test that a name set over the socket is the
name the double-click editor offers to edit.
Verified: eight checks in `tests/test_pane_title.py`. A pane named while its
program keeps setting OSC 2 titles keeps the name; clearing it hands the label back
to what the program calls itself *now*; `id: 0` is the focused pane and leaves the
other one alone; `set-name` with no target still renames the tab and leaves the
pane's title alone.
Diffstat (limited to 'docs/scripting.md')
| -rw-r--r-- | docs/scripting.md | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/scripting.md b/docs/scripting.md index 89dd835..8268c31 100644 --- a/docs/scripting.md +++ b/docs/scripting.md @@ -31,7 +31,9 @@ Panes and tabs are addressed by **id**, so a background tab is scriptable. | `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-name target="pane"` | a pane's name, which outranks the title its program sets | | `move-pane` | `id` of the pane, `tab` id to move it into (`0` for a tab of its own, with an optional `name`), `dir:"cols"\|"rows"`. The pane keeps running — same pty, same scrollback | +| `set-name` | `target:"tab"` (the default, because that is what this verb has always meant) or `"pane"`, `id`, `name`. A pane accepts 0 for the focused one. A pane's name wins over the title the program sets, so this is how a program that keeps announcing something stale gets overruled; an empty `name` clears it and hands the label back. Refusals say `no such pane` or `no such tab`, so a mistyped target is visible in the reply | | `set-purpose` | `target:"pane"\|"tab"`, `id` (or 0 for the focused pane, and the tab you are in), `purpose`. An empty `purpose` clears the slot *and* unlocks it, handing the label back to the program — a lock held over an empty string was a state nothing could get out of | | `dump-layout` `apply-layout` | see [layouts](layouts.md). `dump-layout` takes `tab` (0 for every tab), `relative_to` to write every `cwd=` under that directory instead of absolute, and `suspend` (`as-is` `none` `commands` `all`); it answers `kdl` `panes` `suspended`, and an unknown `tab` is an error rather than an empty document | | `workspaces` | the projects on disk and which of them are open: `roots` says whether any are configured at all, and each entry has `name` `path` `purpose` `layout` (a file path, or "") `mtime` `tab` (0 when closed) — see [workspaces](workspaces.md) | |
