aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-14 13:42:00 +0200
committeruser <user@clank>2026-08-14 13:42:00 +0200
commit4333a40dce43866490396d4418f268c5d1037ff6 (patch)
tree5941187fa14279cfe344ac2b55d6ea58ed66025f /Makefile
parentsl0ppty: the pane title is a name — double-click it to rename (diff)
downloadslosh-4333a40dce43866490396d4418f268c5d1037ff6.tar.gz
slosh-4333a40dce43866490396d4418f268c5d1037ff6.tar.xz
slosh-4333a40dce43866490396d4418f268c5d1037ff6.zip
sl0ppty: terminal shaders — a colour pass over pane contents
A shader is a pure function from (cell, position, parameters) to that cell's colours, applied to a pane's contents. Tinting, dimming and greying are the first three; the point is the mechanism, because it is going to carry a lot of UX later — drag a pane and grey the others, dim what is not focused, mark a pane that wants attention — and all of those want to be a colour pass rather than another special case in the drawing code. Where it runs is the whole design. draw_cb already paints the frame, then the contents, then the split guide, so the pass goes between the last two and "contents, not chrome" stops being a rule anyone has to remember: the frame was painted before and lies outside the content rect, and an affordance painted after stays legible on top of a pane that has been dimmed underneath it. node_t already carries the content rect, so the pass has its bounds. Cells only, and colours and attributes only. Rewriting a cell's text would desync selection and copy, which read the terminal rather than the screen, and could break the wide-cell invariant; the tail half of a wide cell is skipped for the same reason, since shading it computes a colour nothing displays. Each cell is shaded independently — no neighbours — so anything positional works and convolutions do not. That is deliberate: blur would need a second buffer, and everything actually wanted here is a function of position and colour. The context carries the content size and rect-relative coordinates so gradients and vignettes are expressible, plus a timestamp for whatever ends up animated. The one real problem is that "terminal default" has no RGB. We never learn what the client's default foreground is, and most terminal text is default-coloured, so a shader that skipped those cells would leave nearly everything at full brightness and read as broken. The pass materialises them to a configured default_fg/default_bg (white on black) before running, which means a shaded pane stops tracking the terminal's own theme for those cells — so the config exists to make that right, and asking the terminal directly with OSC 10/11 is the eventual fix. A pane with no shaders skips the pass entirely and still defers to the terminal exactly as before. Attachment is internal policy: app_shade_add/clear, callable from inside the app and from nowhere else. Not over the control API and not in-band, so a program in a pane cannot restyle itself. Nothing attaches one yet. Kitty graphics are re-emitted as images rather than cells, so a shader cannot touch them: a greyed pane keeps a full-colour image in it. Known and accepted. Tested as a C unit test, since the pass is pure: the built-ins and their strength scale, luma weighting, chaining order mattering, defaults being materialised, wide-cell tails and text surviving, degenerate input, what the context tells a shader, and — the one that protects the chrome — that the pass touches nothing outside its rect.
Diffstat (limited to '')
-rw-r--r--Makefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ff8943d..409083c 100644
--- a/Makefile
+++ b/Makefile
@@ -51,11 +51,18 @@ KDL_TEST := build/kdl_test
$(KDL_TEST): tests/kdl_test.c src/kdl.c | build
$(CC) $(CFLAGS) tests/kdl_test.c src/kdl.c -o $@
-test: $(BIN) $(TEST_BIN) $(KDL_TEST) ## unit + headless checks (fast)
+SHADER_TEST := build/shader_test
+
+$(SHADER_TEST): tests/shader_test.c src/shader.c src/screen.c src/json.c $(VT_LIB) | build
+ $(CC) $(CFLAGS) tests/shader_test.c src/shader.c src/screen.c src/json.c $(VT_LIB) -o $@
+
+test: $(BIN) $(TEST_BIN) $(KDL_TEST) $(SHADER_TEST) ## unit + headless checks (fast)
./$(TEST_BIN)
@echo
./$(KDL_TEST)
@echo
+ ./$(SHADER_TEST)
+ @echo
cd tests && python3 test_screen.py && python3 test_layout.py && python3 test_tabs.py && python3 test_osc5577.py && \
python3 test_responsive.py && python3 test_finder.py && \
python3 test_config.py && python3 test_layout_files.py && python3 test_drag.py && python3 test_hover.py && python3 test_scroll.py && python3 test_clipboard.py && python3 test_split_ux.py && python3 test_graphics.py && python3 test_pane_title.py