summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-18 14:21:38 -0300
committerGabriel Schneider <[email protected]>2026-08-18 23:45:30 -0300
commit382abe3dafb872b3e6c9792a9cc0abcf6267e180 (patch)
treee30f47d911561db9b02e714287a1658822c77a09 /src/builtins.zig
parentc24a9e40215bc30c68c9db7675f1c6a07d9bbae3 (diff)
downloadpardes-382abe3dafb872b3e6c9792a9cc0abcf6267e180.tar.gz
pardes-382abe3dafb872b3e6c9792a9cc0abcf6267e180.zip
file_watch + builtins + config: richer watch semantics, new builtins, config docs
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig40
1 files changed, 36 insertions, 4 deletions
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
+/// `<config>/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 {