diff options
| author | user <user@clank> | 2026-08-19 14:10:52 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-19 14:10:52 +0200 |
| commit | 1f5b55bc323e89399ec82eca392612ce2c0167a4 (patch) | |
| tree | 84cffc149d0329117013debf04df8ac9c984f144 /include | |
| parent | slosh: split app.c into five units, mechanically (diff) | |
| download | slosh-1f5b55bc323e89399ec82eca392612ce2c0167a4.tar.gz slosh-1f5b55bc323e89399ec82eca392612ce2c0167a4.tar.xz slosh-1f5b55bc323e89399ec82eca392612ce2c0167a4.zip | |
slosh: greet an attach with the logo, wearing a random shader
logo.txt is the source of truth; the Makefile bakes it into
build/logo.h the way version.h is baked. When a client attaches
(MSG_HELLO turning a connection into the display), the logo appears
centered over everything for splash_ms (900, 0 for never), on a
cleared backdrop, in the accent -- and one of six effects runs over
its rect through the ordinary shader pass: a diagonal sheen, plasma,
rings, sparkle, a left-to-right reveal, a breathe. Which one is picked
by the splash's own timestamp, so every attach looks a little
different without anybody keeping a counter.
Every effect reads the clock, so the frame clock runs only while the
splash is up (note_animation, same as any animated chain), and `since`
in a splash context is milliseconds since it appeared, so one-shot
effects sweep exactly once. Any key or click ends it and still lands
where it was aimed: a greeting is not a modal. A screen the box does
not fit on gets no greeting rather than a cropped one.
Headless and scripted sessions never attach, so the whole fast suite
never sees it; {"cmd":"splash"} triggers it on demand, which is what
makes it testable from a scripted session -- and lets you replay the
greeting whenever you like.
Diffstat (limited to 'include')
| -rw-r--r-- | include/app.h | 3 | ||||
| -rw-r--r-- | include/app_internal.h | 7 | ||||
| -rw-r--r-- | include/config.h | 5 |
3 files changed, 14 insertions, 1 deletions
diff --git a/include/app.h b/include/app.h index 2a3435e..7901d33 100644 --- a/include/app.h +++ b/include/app.h @@ -66,6 +66,9 @@ size_t app_fds(app_t *a, int *out, size_t max); void app_reap(app_t *a); void app_compose(app_t *a, screen_t *s); +/* Show the logo splash for splash_ms, centered over everything, wearing a + * different shader effect each time. Called on attach; any input ends it. */ +void app_splash(app_t *a); /* Bytes straight into the focused pane's pty (the harness's `raw`). */ void app_write_focused(app_t *a, const void *buf, size_t len); bool app_should_quit(const app_t *a); diff --git a/include/app_internal.h b/include/app_internal.h index bc94408..441bbd4 100644 --- a/include/app_internal.h +++ b/include/app_internal.h @@ -261,6 +261,11 @@ struct app { * remembering "this session animates" would keep a clock running for a pulse * that was hung off a state no pane is in any more. */ bool animating; + + /* The logo splash: shown until this instant, 0 for not at all. Set when a + * client attaches (app_splash), ended early by any key or click. The + * timestamp doubles as the seed that picks which effect this one wears. */ + int64_t splash_until; }; /* One config per process, owned by app.c (ensure_config/app_reload_config @@ -366,6 +371,8 @@ void purpose_begin(app_t *a, uint32_t id); void rename_begin(app_t *a, uint32_t id); void rename_tab_begin(app_t *a, uint32_t id); +void draw_splash(app_t *a, screen_t *s); + /* round two */ void drop_pane_on_strip(app_t *a); void focus_next(app_t *a); diff --git a/include/config.h b/include/config.h index ce4d5b0..5aefd01 100644 --- a/include/config.h +++ b/include/config.h @@ -194,7 +194,10 @@ typedef struct { * and a silently wrapped limit is worse than a refused one. */ size_t scrollback; size_t scrollback_bytes; - uint16_t toast_ms; /* how long an announcement stays up */ + uint16_t toast_ms; /* how long an announcement stays up */ + /* How long the logo splash stays over a freshly attached screen, 0 for + * never. Attach-only: a headless or scripted session has nobody to greet. */ + uint16_t splash_ms; uint16_t hover_delay_ms; /* how long the pointer must rest to arm a guide */ uint16_t double_click_ms; /* how close two clicks must be to be a double */ /* What a double-click's word stops at, listed as *separators* rather than as |
