aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-19 13:46:57 +0200
committeruser <user@clank>2026-08-19 13:46:57 +0200
commit42b3c10995eb67778d9dd3aa2fd80624896acd5f (patch)
tree751bcb8604967dc8687cf23fbeb1033aa26ca427 /contrib
parentslosh: a website that is a page, not a mock session (diff)
downloadslosh-42b3c10995eb67778d9dd3aa2fd80624896acd5f.tar.gz
slosh-42b3c10995eb67778d9dd3aa2fd80624896acd5f.tar.xz
slosh-42b3c10995eb67778d9dd3aa2fd80624896acd5f.zip
slosh: defaults most people can live in, said by shaders
The out-of-the-box look, rethought as one piece: - the compiled-in palette calms down: muted blue #7aa2f7 on the same neutral darks, with the colours that mean something kept semantic -- amber bell, red-orange dead. sl0p stays one include away as the house style, and contrib/themes/default.kdl is the starting point written down (theme-tour shows it). - derived state defaults now actually follow the theme: the scrolled wash is rebuilt from scroll_bg after the theme block (it used to bake the compiled accent), and declaring a state -- in any file of an include chain -- still wins. The dump writes derived states as comments so C-a e cannot pin what is meant to keep following. - a bell you can see: the frame blinks three times in theme's bell colour then breathes until answered, and a soft diagonal shimmer -- the bell colour halved towards default_fg, width breathing on a sine -- crosses the body for the same 900ms. bell_indicator false silences all of it; states { bell { } } replaces it like any state. since carries the clock dependency, so an idle session pays nothing. - scrollback says where it continues: while scrolled, the viewport's top and bottom rows melt towards an edge with content past it and turn solid at the buffer's end. New expression variables above/below (lines hidden past each edge, own dependency bit, cached per scroll position), carried in shade_ctx_t -- SLOSH_SHADER_ABI 3 -> 4. - expressions survive the dump: a program keeps its source and cb_chain writes it back, so amount="(y % 2) * 40" no longer dumps as a number. - headers move to include/, -Iinclude everywhere; the plugin Makefile's SLOSH var becomes SLOSH_DIR because slosh exports SLOSH=1 into every pane it runs, and building from inside a session read that as a path. - comment drift culled where features outran the prose, and the derivation boilerplate folded into derived_pass()/ctx_scroll().
Diffstat (limited to 'contrib')
-rw-r--r--contrib/README.md22
-rw-r--r--contrib/shader-plugin/Makefile11
-rw-r--r--contrib/shader-plugin/README.md2
-rwxr-xr-xcontrib/shader-repl15
-rw-r--r--contrib/themes/default.kdl81
-rw-r--r--contrib/themes/sl0p.kdl4
6 files changed, 124 insertions, 11 deletions
diff --git a/contrib/README.md b/contrib/README.md
index c932199..5809694 100644
--- a/contrib/README.md
+++ b/contrib/README.md
@@ -4,13 +4,14 @@ Things that are useful but are not the multiplexer.
## themes/
-Six complete themes. Each sets **every** colour the config knows about, so
+Seven complete themes. Each sets **every** colour the config knows about, so
nothing silently falls back to a compiled-in default that belongs to a
different palette — there is a test that keeps them that way.
| | |
|---|---|
-| `sl0p` | the default: hot pink on near-black |
+| `default` | what no config gets you: muted blue on neutral dark |
+| `sl0p` | the house style: hot pink on near-black |
| `phosphor` | a green CRT that never quite went away |
| `amber` | the other CRT, for people who found green loud |
| `slate` | muted blues, for looking at all day |
@@ -99,7 +100,7 @@ A skeleton for adding your own shaders as a shared library, with a Makefile
and two worked examples (`checker`, `pulse`). Build it, drop the `.so` in
`~/.config/slosh/shaders/`, and name it in your config like a built-in.
-The only header a plugin needs is `src/shader_abi.h`. What a shader may and
+The only header a plugin needs is `include/shader_abi.h`. What a shader may and
may not do — and why a plugin is native code rather than a sandboxed one —
is in that directory's README.
@@ -135,6 +136,21 @@ that computes zero everywhere, because an example that does nothing reads as
a broken shader system rather than a bad example. It found its first bug on
its first run.
+## webdemo/
+
+slosh in a browser tab, for people who want to try it without installing it:
+a riscv64 Linux booted by Bellard's TinyEMU compiled to WebAssembly, an Alpine
+userland we build into a disk image, and slosh as the thing you land in.
+
+```sh
+cd contrib/webdemo && make && make serve
+```
+
+The output is static files, so it can be served from anywhere that can serve a
+directory. `make check` boots the same image in a native emulator and asserts
+the session comes up, which is how a change to the guest is tested without
+opening a browser at all.
+
## coverage
```sh
diff --git a/contrib/shader-plugin/Makefile b/contrib/shader-plugin/Makefile
index 1240c85..1a0fb5d 100644
--- a/contrib/shader-plugin/Makefile
+++ b/contrib/shader-plugin/Makefile
@@ -1,22 +1,25 @@
# Build a slosh shader plugin.
#
-# The only thing a plugin needs is src/shader_abi.h. Any C compiler will do —
+# The only thing a plugin needs is include/shader_abi.h. Any C compiler will do —
# zig is used here because the project already depends on it, not because it
# has to be. Out of tree, copy shader_abi.h next to your source and drop the
# -I below.
-SLOSH ?= ../..
+# Not `SLOSH ?=`: slosh itself exports SLOSH=1 into every pane it runs (the
+# way tmux exports TMUX), so building *from inside a session* -- the normal
+# case -- would read that as the path.
+SLOSH_DIR ?= ../..
ZIG ?= $(HOME)/zig-0.16.0/zig
CC ?= $(ZIG) cc
-CFLAGS := -std=c23 -O2 -Wall -Wextra -fPIC -I$(SLOSH)/src
+CFLAGS := -std=c23 -O2 -Wall -Wextra -fPIC -I$(SLOSH_DIR)/include
PREFIX ?= $(HOME)/.config/slosh/shaders
.PHONY: all install clean
all: example.so ## build the plugin
-example.so: example.c $(SLOSH)/src/shader_abi.h
+example.so: example.c $(SLOSH_DIR)/include/shader_abi.h
$(CC) $(CFLAGS) -shared $< -o $@
install: example.so ## copy it where slosh looks
diff --git a/contrib/shader-plugin/README.md b/contrib/shader-plugin/README.md
index 6c5150a..d8ee7e3 100644
--- a/contrib/shader-plugin/README.md
+++ b/contrib/shader-plugin/README.md
@@ -30,7 +30,7 @@ a plugin, restart the session.
## Writing one
-Everything you need is in [`src/shader_abi.h`](../../src/shader_abi.h) — one
+Everything you need is in [`include/shader_abi.h`](../../include/shader_abi.h) — one
header, no libghostty-vt, no other slosh types. `example.c` is a working
plugin with two effects and comments about what each one demonstrates.
diff --git a/contrib/shader-repl b/contrib/shader-repl
index 72df0be..c0ff216 100755
--- a/contrib/shader-repl
+++ b/contrib/shader-repl
@@ -123,7 +123,20 @@ PROPS = [
]
# Values worth offering: the two rects, the three channels.
VALUES = ['"chrome"', '"content"', '"fg"', '"bg"', '"both"']
-VARS = ["x", "y", "cols", "rows", "curx", "cury", "cursor", "focused", "t", "since"]
+VARS = [
+ "x",
+ "y",
+ "cols",
+ "rows",
+ "curx",
+ "cury",
+ "cursor",
+ "focused",
+ "t",
+ "since",
+ "above",
+ "below",
+]
# Angles are degrees, so pi is a half turn: `PI` is 180 and `TAU` is 360.
CONSTS = ["PI", "TAU"]
FUNCS = ["min(", "max(", "abs(", "clamp(", "dist(", "sin(", "cos("]
diff --git a/contrib/themes/default.kdl b/contrib/themes/default.kdl
new file mode 100644
index 0000000..0d8f7a8
--- /dev/null
+++ b/contrib/themes/default.kdl
@@ -0,0 +1,81 @@
+// default -- what no config gets you: muted blue on neutral dark
+//
+// This file exists so the tour can show the starting point and so another
+// theme is one include-swap away from coming back. It matches the compiled-in
+// palette exactly (`slosh --dump-config` is the authority if they ever drift).
+//
+// Two colours mean something rather than match something: `bell` is amber
+// (attention, not focus) and `dead` is warm red-orange. Everything else that
+// says "this one" -- the focused frame, the guide, the active tab -- is one
+// muted blue, calm enough to frame text without shouting over it.
+theme {
+ // what a shader takes "terminal default" to mean
+ default_fg "#ffffff"
+ default_bg "#000000"
+
+ // panes
+ frame_focus "#7aa2f7"
+ frame_idle "#45454a"
+ title "#ffffff"
+ title_idle "#45454a"
+
+ // a pane's own OSC 5577 buttons
+ button_fg "#141418"
+ button_bg "#7aa2f7"
+ button_bg_idle "#55555c"
+
+ // affordances under the pointer
+ guide "#7aa2f7"
+ resize "#7aa2f7"
+ drop_target "#7aa2f7"
+
+ // scrollback indicator
+ scroll_fg "#141418"
+ scroll_bg "#7aa2f7"
+
+ // rows of a tab collapsed into a list
+ header "#45454a"
+ header_hover "#7aa2f7"
+ header_hover_title "#ffffff"
+
+ // the strip along the top
+ tab_active_fg "#141418"
+ tab_active_bg "#7aa2f7"
+ tab_active_hover_fg "#ffffff"
+ tab_idle "#45454a"
+ tab_hover "#7aa2f7"
+ prefix_fg "#141418"
+ prefix_bg "#7aa2f7"
+ tab_count "#45454a"
+
+ // the line along the bottom
+ status "#45454a"
+ status_state "#ffffff"
+ hint "#ffffff"
+
+ // the pane finder
+ finder_fg "#ffffff"
+ finder_bg "#45454a"
+ finder_sel_fg "#141418"
+ finder_sel_bg "#7aa2f7"
+
+ // rename editor, bell, dead panes, frame buttons, the minimised bar
+ rename_fg "#141418"
+ rename_bg "#7aa2f7"
+ toast_fg "#141418"
+ toast_bg "#7aa2f7"
+ bell "#e0af68"
+ dead "#ff875f"
+ pane_button "#45454a"
+ pane_button_hover "#7aa2f7"
+ minbar "#45454a"
+ minbar_hover "#7aa2f7"
+
+ // a modal floating over the layout (the cheatsheet, C-a ?)
+ modal_bg "#1c1c22"
+ modal_fg "#e8e8ea"
+ modal_border "#7aa2f7"
+ modal_title "#ffffff"
+ modal_button "#8a8a95"
+ modal_button_hover "#7aa2f7"
+}
diff --git a/contrib/themes/sl0p.kdl b/contrib/themes/sl0p.kdl
index cc13f89..680f166 100644
--- a/contrib/themes/sl0p.kdl
+++ b/contrib/themes/sl0p.kdl
@@ -1,4 +1,4 @@
-// sl0p -- the default: hot pink on near-black
+// sl0p -- the house style: hot pink on near-black
//
// Drop into ~/.config/slosh/config.kdl, or point $SLOSH_CONFIG at a file
// that contains it. A running session re-reads it the moment you save.
@@ -16,7 +16,7 @@ theme {
// a pane's own OSC 5577 buttons
button_fg "#141418"
button_bg "#ff5fd7"
- button_bg_idle "#45454a"
+ button_bg_idle "#55555c"
// affordances under the pointer
guide "#ff5fd7"