diff options
| author | user <user@clank> | 2026-08-15 16:22:27 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-15 16:22:27 +0200 |
| commit | 95b9b0414a2a8a3b1ec8e91d530c8b7119901257 (patch) | |
| tree | 8c8929534ab94f1a3c53de41ea108216d69b66bc /config | |
| parent | sl0ppty: C-a e opens the config, in a pane, in your editor (diff) | |
| download | slosh-95b9b0414a2a8a3b1ec8e91d530c8b7119901257.tar.gz slosh-95b9b0414a2a8a3b1ec8e91d530c8b7119901257.tar.xz slosh-95b9b0414a2a8a3b1ec8e91d530c8b7119901257.zip | |
sl0ppty: render the config instead of shipping a copy of it
`C-a e` on a machine with no config opened an empty buffer, which tells you
nothing about what you can set. The obvious fix -- embed config/config.kdl and
write it out -- trades one problem for a worse one: a checked-in copy of the
defaults is a second source of truth, and it drifts. Ours already had. Four
theme colours existed in the code and not in that file, and nothing said so.
So the file is generated. `sl0ppty --dump-config` renders every setting with
the value it currently holds -- geometry, behaviour, all 48 theme colours, the
state shader chains, and every binding including the leader-less ones -- and
`C-a e` seeds a missing config with exactly that, creating the directories on
the way (a fresh container has no ~/.config either).
config/config.kdl stays, and is now explicitly the *prose*: what a setting is
for, what it cost to get right, which ones are opinions. Values are generated,
essays are written, and the file says so at the top.
Three things keep the two honest:
- the theme colours became one file-scope table that the parser and the
renderer both walk. 48 names that used to exist in one place and be typed
again in another now exist once.
- the dump must parse back to itself byte-for-byte. That is what caught
`bind \ split-cols` rendering unquoted -- valid-looking output that would
not have survived being read back.
- a test scans config.c for `kdl_child(root, "...")`, which is the parser's
own vocabulary, and fails if a key is missing from the dump. Add a knob,
forget to render it, and the suite tells you rather than a user.
It never overwrites a config that exists: fopen(..., "wx") loses the race
rather than an edit, and there is a test for that too, because it is the one
thing here that must never go wrong.
Diffstat (limited to 'config')
| -rw-r--r-- | config/config.kdl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/config/config.kdl b/config/config.kdl index 15ef8b0..52b9c79 100644 --- a/config/config.kdl +++ b/config/config.kdl @@ -1,3 +1,11 @@ +// This file is the *reasoning*: what each setting is for, what it cost to +// get right, and which ones are opinions. The values themselves come out of +// the code -- `sl0ppty --dump-config` writes every knob with the value it +// actually holds, and `C-a e` seeds a missing config with exactly that. +// +// So if the two ever disagree, the dump is right and this file is stale; +// tests/test_dump_config.py fails when a setting exists and is not rendered. +// // sl0ppty — every value here is also the compiled-in default, so this file is // documentation as much as configuration. Copy it to // ~/.config/sl0ppty/config.kdl (or point $SL0PPTY_CONFIG at it) and edit. |
