diff options
| author | user <user@clank> | 2026-08-15 16:27:50 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-15 16:27:50 +0200 |
| commit | 4f64774f910347ce8a27c3aecc7f1c2ac167301b (patch) | |
| tree | f1c762382e86171de1b9212aa0c04a9e7b655a72 /src/server.c | |
| parent | sl0ppty: render the config instead of shipping a copy of it (diff) | |
| download | slosh-4f64774f910347ce8a27c3aecc7f1c2ac167301b.tar.gz slosh-4f64774f910347ce8a27c3aecc7f1c2ac167301b.tar.xz slosh-4f64774f910347ce8a27c3aecc7f1c2ac167301b.zip | |
sl0ppty: watch the config directory even when it is not there yet
You were right. The watch is on the *directory* -- editors write a new file
and rename it over the old one, so watching the file stops working the first
time you save -- but a directory that does not exist cannot be watched at
all. inotify_add_watch failed, the session gave up on watching for good, and
writing a config later did nothing until a restart. Which is exactly the
state a fresh machine is in, and exactly the state C-a e leaves you in.
sl0ppty creates its own config directory at startup now, so there is always
something to watch and a file appearing later is picked up. Tested from a home
directory with no .config at all.
Answering the other half of the question -- which settings actually reload --
turned up one that never worked at all: `shell`. main.c read $SHELL directly
and nobody read the config's value, so the setting parsed, rendered in
--dump-config, and did nothing. It is resolved per pane now, which fixes it and
makes it live: edit it, save, and the next pane you open uses it.
Everything else measured rather than assumed, and it is nearly everything:
colours, geometry, the status bar and line, frame marks, shader chains and
their states, and the keys including the leader itself. The two exceptions are
about *when* a value is read, not reluctance -- `shell` at pane creation, and
shader plugins which load on reload but never unload. Both are now written
down where someone would look.
One test needed rescuing from itself: it asserted the new leader worked by
splitting, in panes that were by then too narrow to split. A test that fails on
geometry while claiming to be about the prefix is worse than no test; it opens
a tab instead.
Diffstat (limited to 'src/server.c')
| -rw-r--r-- | src/server.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server.c b/src/server.c index 498b83f..242be26 100644 --- a/src/server.c +++ b/src/server.c @@ -239,6 +239,13 @@ int server_run(const char *name, const char *const argv[], uint16_t cols, snprintf(cfg_dir, sizeof cfg_dir, "."); snprintf(cfg_base, sizeof cfg_base, "%s", path); } + /* The watch is on the directory, not the file -- editors write a new + * file and rename it over the old one, so watching the file itself + * stops working the first time you save. But a directory that is not + * there cannot be watched at all, and then nothing is ever noticed for + * the life of the session: no config, no watch, and saving one later + * does nothing until a restart. Ours to create, so create it. */ + path_mkdirs(cfg_dir); inofd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); if (inofd >= 0) { inowd = inotify_add_watch(inofd, cfg_dir, |
