diff options
| author | sl0p <sl0p@sl0p.foo> | 2026-08-13 22:52:33 +0200 |
|---|---|---|
| committer | sl0p <sl0p@sl0p.foo> | 2026-08-13 22:52:33 +0200 |
| commit | 7a6fa40a9c49245cf569e10e6ed635f9a6cbbcb7 (patch) | |
| tree | 93f11a476bcdb6fe50f2f3e28fa865b86d3d06c3 /src/app.c | |
| parent | sl0ptty: M1 — layout tree, splits, focus, frames, and the hit list in use (diff) | |
| download | slosh-7a6fa40a9c49245cf569e10e6ed635f9a6cbbcb7.tar.gz slosh-7a6fa40a9c49245cf569e10e6ed635f9a6cbbcb7.tar.xz slosh-7a6fa40a9c49245cf569e10e6ed635f9a6cbbcb7.zip | |
sl0ptty: M2 — server/client split, detach/reattach, control socket
The session now outlives its client, which is the point: agents keep running
while you are gone. The server owns the panes, the layout and the renderer;
the client is a terminal in raw mode and a socket, forwarding bytes and
painting what it is sent. It does not even decode input, so the decoder can
change without redeploying clients.
sl0ptty attach to 'main', creating it if nobody is home
sl0ptty -s NAME a named session
sl0ptty ls live sessions
sl0ptty cmd LINE one control command
C-a d detach
Connections are not clients. A connection becomes the display client only by
sending HELLO; control commands and liveness probes are just connections and
never displace anybody. This was found the hard way, one hour after the server
first ran: 'sl0ptty ls' kicked the attached client off, because ls connects to
see whether a socket answers. That is precisely the fault that gave the zellij
fork a 20-25% CLI failure rate, rebuilt and then fixed structurally. The
regression runs 20 x (ls + control) against a live client and demands 0
failures and a client that can still type.
cmd.c now holds the command vocabulary once, shared by the headless driver and
the control socket, so a script written against one works against the other —
'sl0ptty cmd "snapshot text"' against a detached session prints its screen.
tests/test_session.py: 18 checks over create, split, probe-resistance, detach,
survival, drive-while-detached, reattach, displacement and cleanup.
123 checks green overall.
Diffstat (limited to 'src/app.c')
| -rw-r--r-- | src/app.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -54,6 +54,7 @@ struct app { uint16_t cols, rows; bool prefix; bool quit; + bool detach; const char *const *argv; /* the screen we last composed into: its hit list is what a click resolves * against, so routing can never consult geometry the user never saw */ @@ -102,6 +103,8 @@ void app_free(app_t *a) { } bool app_should_quit(const app_t *a) { return a->quit || a->root == NULL; } +bool app_detach_requested(const app_t *a) { return a->detach; } +void app_clear_detach(app_t *a) { a->detach = false; } /* ---- walking ------------------------------------------------------------ */ @@ -510,6 +513,7 @@ static void do_action(app_t *a, const char *action, const input_event_t *ev) { static bool prefix_command(app_t *a, const input_event_t *ev) { switch (ev->key) { case GHOSTTY_KEY_Q: a->quit = true; return true; + case GHOSTTY_KEY_D: a->detach = true; return true; case GHOSTTY_KEY_BACKSLASH: /* C-a \ or C-a | */ split_focus(a, SPLIT_COLS); return true; |
