diff options
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 40 |
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 { |
