No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
nnra6864 6a16d7c827 chore: Dependencies come from the ktisigonos organization
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 01:23:02 +01:00
.gitignore chore: Zig's caches and fetched packages are ignored 2026-11-10 16:09:48 +01:00
build.zig feat: kosm_lua sets values by path in Lua files, however they nest them 2026-11-06 16:37:33 +01:00
build.zig.zon chore: Dependencies come from the ktisigonos organization 2026-11-11 01:23:02 +01:00
README.md feat: Paths see into if and do blocks, which run as the file loads 2026-11-10 19:25:23 +01:00
root.zig feat: Paths see into if and do blocks, which run as the file loads 2026-11-10 19:25:23 +01:00

kosm_lua

Lua for kosm: the lua adapter, claiming .lua files and enabling edit.

var file = try output.edit(.{ .files = "~/.config/hypr/defs.lua" });
try file.set("M.blur.enabled", self.blur);
try file.set("M.border.active_col", self.border_active.format("rgba({})", &.{.hex8}));

A path matches however the file nests its keys. Each of these holds M.blur.enabled:

M.blur = { enabled = true }
M.blur.enabled = true
local M = { blur = { enabled = true } }
hl.config({ M = { blur = { enabled = true } } })

Function calls are transparent, so hl.config({ general = {...} }) holds general. Code inside function bodies (keybind callbacks, function ... end) runs later, not when the file loads, so paths never see it. A target whose key isn't spelled out (M[key] = 1) is skipped. A key written as ["col.active"] = ... is the quoted path segment "col.active". Code inside if and do blocks runs as the file loads, so paths see into it; a value set in several branches matches several times.

A table spelled only through dotted keys (M.blur in M.blur.enabled = true) has no bytes of its own, so it can't be replaced; set its keys instead.

Only the value's bytes change; comments, spacing and key order stay as they are.

Value Written as
string a double-quoted Lua string, escaped
color a string in the file's color format; default #rrggbb
integer, float the number; floats at the file's precision, never infinity or NaN
bool true or false; format.boolean must stay .true_false
struct { key = value } on one line, ["key"] = value for keys that aren't names
list { a, b } on one line
kosm.raw(text) text, verbatim

Paths name keys only. Positional table entries ({ "a", "b" }) aren't reached by paths or by elements yet.