aboutsummaryrefslogtreecommitdiffstats
path: root/include/project.h
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 /include/project.h
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 'include/project.h')
-rw-r--r--include/project.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/project.h b/include/project.h
new file mode 100644
index 0000000..6bf3021
--- /dev/null
+++ b/include/project.h
@@ -0,0 +1,64 @@
+/* Projects on disk, and the workspaces they open as.
+ *
+ * A *project* is a directory somebody works in. A *workspace* is the tab it
+ * currently occupies in a session. This file is about the first: finding them,
+ * naming them, and saying where each one's layout lives. The second lives in
+ * app.c, because a workspace is tabs.
+ *
+ * The list is derived when it is asked for rather than watched. One readdir per
+ * root plus two faccessat per entry is forty checkouts for eighty-one syscalls,
+ * which is nothing next to the keystroke that asked -- and an answer nobody
+ * remembered cannot be stale, which no watcher can promise on a bind mount.
+ */
+#ifndef SLOSH_PROJECT_H
+#define SLOSH_PROJECT_H
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* The file a project uses to say what it needs. One name, so there is no
+ * precedence question: a layout file by D2's rule, checked by `--check`, and
+ * highlighted by anything that knows KDL. */
+#define PROJECT_LAYOUT_FILE "slosh.layout.kdl"
+
+/* How many projects one session will look at. A picker is not a filesystem
+ * browser: past this many the answer to "which project" is a search, not a
+ * list, and the list is what this is for. */
+#define PROJECTS_MAX 128
+
+typedef struct {
+ char name[64]; /* the directory's own name, which is what people call it */
+ char path[512]; /* absolute, resolved */
+ char slug[64]; /* `project:name.hash8` -- the purpose a workspace carries */
+ /* The project's own layout file, or "" for one inferred from a `.git`. The
+ * distinction is the whole of what "declared" means here, and the picker
+ * shows it: a project with no layout is an invitation to save one. */
+ char layout[512];
+ int64_t mtime; /* of `layout`, 0 when there is none. Drift is derivable from
+ * this and a pane's `since` without anything storing it. */
+} project_t;
+
+/* Every project under `roots`, sorted by name. `roots` is a NUL-terminated
+ * array of directories; `depth` is how many levels below each to look, and a
+ * directory that *is* a project is never descended into -- which is what keeps
+ * this off node_modules without a rule about node_modules.
+ *
+ * A root that does not exist is not an error. Neither is one with nothing in
+ * it: the setting is a statement of where you keep things, not a promise that
+ * you have any. */
+size_t project_scan(const char *const *roots, int depth, project_t *out,
+ size_t max);
+
+/* One project by name, or by path when `name` looks like one (it has a `/`).
+ * False when no root holds it -- which is also the containment check, since a
+ * path that no root holds is a path this session will not write to. */
+bool project_find(const char *const *roots, int depth, const char *name,
+ project_t *out);
+
+/* The purpose a workspace for this directory carries: `project:<name>.<hash>`
+ * of the resolved path. Hashed on the path rather than the name so that two
+ * worktrees of one repo are two workspaces, which is what they are. */
+void project_slug(const char *path, const char *name, char *out, size_t cap);
+
+#endif /* SLOSH_PROJECT_H */