From 382abe3dafb872b3e6c9792a9cc0abcf6267e180 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 18 Aug 2026 14:21:38 -0300 Subject: file_watch + builtins + config: richer watch semantics, new builtins, config docs --- src/builtins.zig | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index d42aeafc..3f1c5f85 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -325,6 +325,37 @@ pub const ThemeSel = struct { } }; +/// Load one complete Theme value from a .zon file. Relative paths are rooted +/// at the per-user pardes directory, so an init line can simply say +/// `ThemeFile themes/mine.zon`. The native host owns the read and watch; the +/// core owns parsing and keeps the last valid value across a bad live edit. +pub const ThemeFile = struct { + pub const takes_arg = true; + pub const enabled = pardes.platform != .web; + pub fn run(c: Ctx) void { + if (comptime enabled) + c.p.requestThemeFile(c.id, c.arg orelse return) + else + unreachable; + } +}; + +/// Materialize every compiled theme as editable ZON under +/// `/themes/builtin`. Filesystem work remains a host effect, just like +/// Dump and Save; the build-time ring itself is the sole source of the data. +pub const DumpThemes = struct { + pub const enabled = pardes.platform != .web; + pub fn run(c: Ctx) void { + if (comptime enabled) { + if (c.p.opts.config_dir == null) { + c.p.reportError(c.id, "dump themes", error.NoConfigDirectory); + return; + } + c.p.emit(.{ .dump_themes = .{ .pane = @intCast(c.id) } }); + } else unreachable; + } +}; + // ---- the GUI's font list, and NOTHING on any other platform ---- // // Runtime settings such as Font are generated from runtime_config.settings. @@ -579,10 +610,11 @@ pub const Help = struct { /// /// The one question docs/config.md cannot answer, because the answer depends /// on the machine: XDG_CONFIG_HOME if it is set and absolute, else -/// ~/Library/Application Support/pardes on macOS and ~/.config/pardes -/// everywhere else. Printing it beats documenting it — the row is ordinary -/// text, so a right click on it opens the file, and when there is no file -/// there yet the path is still exactly what you needed to know. +/// ~/Library/Application Support/pardes/init on macOS and +/// ~/.config/pardes/init everywhere else. Printing it beats documenting it — +/// the row is ordinary text, so a right click on it opens the file, and when +/// there is no file there yet the path is still exactly what you needed to +/// know. pub const Config = struct { pub const output: OutputTraits = .{ .name = config.config_buffer }; pub fn run(c: Ctx) void { -- cgit v1.3