diff options
| author | user <user@clank> | 2026-08-15 23:14:34 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-15 23:14:34 +0200 |
| commit | a25a83d9493d552dbfbe62b12eb9f6070d9e6230 (patch) | |
| tree | b8ea4bc48070850dcc093f365f3984ba082cdbb2 /docs/scripting.md | |
| parent | sl0ppty: shaders on the chrome, and two keys for the arrangement (diff) | |
| download | slosh-a25a83d9493d552dbfbe62b12eb9f6070d9e6230.tar.gz slosh-a25a83d9493d552dbfbe62b12eb9f6070d9e6230.tar.xz slosh-a25a83d9493d552dbfbe62b12eb9f6070d9e6230.zip | |
sl0ppty: a config can be made of files
include "themes/amber.kdl"
include "keys/vim.kdl" "shaders/crt.kdl"
which is how you switch a theme by editing one line rather than pasting
one in. Nothing about it is theme-specific: an include is another config
file applied here, so the same line composes keys, shader chains, states
or geometry, and contrib/themes stops being a directory you copy out of.
A relative path is relative to *the file doing the including*, never to
the directory the session was started from -- a config is a thing on disk
that refers to its neighbours, and where you were standing is not part of
what it means. A leading `~` is a home directory, an absolute path is
itself, and an included file may include others.
What you include is the base: the file with the `include` line in it wins
wherever they disagree, and a later include wins over an earlier one.
That holds wherever the line sits, because the loader reads a document by
asking it for the keys it knows rather than walking it top to bottom --
so "here" is not a position it could honour, and "the file you are
editing wins" is the rule worth having anyway. It is what makes a theme
something you can put two lines on top of.
A depth limit rather than a set of files already seen, because the two
failures it has to stop are the same failure: a config that includes
itself and a config eleven files deep are both a mistake, and the message
says which one you have. A file that will not load is skipped and the
rest of the config still applies (D9) -- losing your keybindings over a
mistyped theme name would be the worse answer.
The loader was already shaped for this: `config_load` applied one parsed
root onto a config_t, so it becomes a recursive `load_into` that applies
its includes first and then itself. Errors from an include get their own
buffer, so a broken theme cannot overwrite a message the file that
included it has already produced.
tests/test_include.py covers the two rules that carry the weight -- the
outer file winning either way round, and a nested include resolving
against the file that wrote it -- plus multiple files on one line, `~`, a
binding from an included file, a missing file, a cycle, switching theme
through a reload, and every file in contrib/themes applying as an
include, checked against each file's own frame_focus so it cannot pass by
looking default.
Not yet: an included file is not watched, so editing the theme itself
does not reload the session. Editing the include line does.
Diffstat (limited to 'docs/scripting.md')
0 files changed, 0 insertions, 0 deletions
