diff options
| author | user <user@clank> | 2026-09-02 14:57:13 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-02 14:57:13 +0200 |
| commit | d698946464f25a0eb43730ffad15656f3247f56b (patch) | |
| tree | 0d040eb64e433122f982ea45912eba37ab54822a /include | |
| parent | Add competitive multiplayer support. (diff) | |
| download | slosh-d698946464f25a0eb43730ffad15656f3247f56b.tar.gz slosh-d698946464f25a0eb43730ffad15656f3247f56b.tar.xz slosh-d698946464f25a0eb43730ffad15656f3247f56b.zip | |
multi-attach: the config knobs
The patch made shared attach unconditional; these make it a policy.
multi_attach false restores the classic displacing attach
(EXIT_REPLACED, which old clients already understand). size_follows
picks whose size the shared screen takes: active (the patch's rule),
smallest (the tmux rule: filler, never a crop), or largest. The size
fold lives in apply_canvas, so any attach, resize or departure can
move the canvas under the folding policies -- including a non-active
client leaving, which under smallest may have been the very client
holding the floor down. A config reload re-applies both knobs to the
running session.
Diffstat (limited to 'include')
| -rw-r--r-- | include/app.h | 5 | ||||
| -rw-r--r-- | include/config.h | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/include/app.h b/include/app.h index 92f2f85..b3dd57c 100644 --- a/include/app.h +++ b/include/app.h @@ -59,6 +59,11 @@ bool app_reload_config(char *err, size_t errcap); /* The files the config in force was read from: the one that was loaded and * everything it included, existing or not. What the watcher watches. */ size_t app_config_files(const char **out, size_t max); +/* The attach-sharing knobs, read fresh so a config reload changes policy on + * a running session: may several clients attach at once, and whose size the + * shared screen takes (SIZE_FOLLOWS_* in config.h). */ +bool app_cfg_multi_attach(void); +int app_cfg_size_follows(void); /* What the config in force complained about while loading, or "". A complaint is * not a failure -- an include that is not there, a shader nobody has heard of -- * so the session is running either way; this is for saying so. */ diff --git a/include/config.h b/include/config.h index fee6b2e..9db9c53 100644 --- a/include/config.h +++ b/include/config.h @@ -112,6 +112,13 @@ typedef struct { typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT } align_t; +/* size_follows: which attached client sizes the shared screen. */ +enum { + SIZE_FOLLOWS_ACTIVE = 0, /* newest attach, then last input */ + SIZE_FOLLOWS_SMALLEST, /* min over clients: filler, never a crop */ + SIZE_FOLLOWS_LARGEST, /* max over clients: crops, never filler */ +}; + /* How many files one config may be built from: itself plus its includes. Small * and fixed, because a config assembled from more than this many pieces is a * thing nobody can read. */ @@ -306,6 +313,18 @@ typedef struct { uint16_t status_pad; bool focus_follows_mouse; + /* Several terminals may attach to one session at once (the default). + * false restores the classic rule: a new client displaces the one before + * it, which is what anyone using attach-from-elsewhere as "move my session + * here and *close it there*" actually wants. */ + bool multi_attach; + /* Whose size the shared screen takes when several clients are attached: + * the active client (newest attach, then last input -- the default), or + * the smallest / largest attached one. Smallest is the tmux rule: nobody + * is cropped and the roomiest terminal pays in filler; largest gives the + * big display everything and small ones a cursor-following crop. */ + int size_follows; + /* Whether Ctrl-D at an idle shell prompt exits that shell, the way the tty * line discipline would do it on POSIX. * |
