diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:58:05 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 00:09:51 -0300 |
| commit | 90ed7135c7367a97131cfcc23cd61f905c5f4a47 (patch) | |
| tree | 299c7f4fce4c14b0e96afcd38f5faa50ec82ac69 /src/config.zig | |
| parent | 55492ffa53d7df11a38c6639f8fde6cdc87800c7 (diff) | |
| download | pardes-90ed7135c7367a97131cfcc23cd61f905c5f4a47.tar.gz pardes-90ed7135c7367a97131cfcc23cd61f905c5f4a47.zip | |
config, ctl: the root ctl reads DumpConfig's setting lines (Runtime.writeSettings, writeReport's first part), where ctl's writeSettingsFor said each setting a second time: /ctl now says a setting the frontend lacks as a `# Word unsupported` comment, Font as the path or name asked for (no size unless one was), Shader off with no file in the chain, DumpDir as written (`# DumpDir (none)` with no directory), and DumpConfig on the web says `# TaglineSize unsupported` where it gave state's 100 beside the build-time size; every line still writes back
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/config.zig')
| -rw-r--r-- | src/config.zig | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/config.zig b/src/config.zig index eb5fe361..976c8a3d 100644 --- a/src/config.zig +++ b/src/config.zig @@ -1437,20 +1437,21 @@ pub const Runtime = struct { return error.NotOnOrOff; } - // Slices are borrowed for one writeReport call. + // Slices are borrowed for one writeReport call. A root ctl read + // (writeSettings) leaves what only the report's trailer says unset. pub const ReportContext = struct { - startup_config_path: ?[]const u8, - platform: []const u8, + startup_config_path: ?[]const u8 = null, + platform: []const u8 = "", theme_name: []const u8, /// The ThemeFile in effect, said as `ThemeFile <path>` in place /// of the theme's name. theme_file: ?[]const u8 = null, compiled_default_shell: []const u8, - hover_delay_frames: u16, + hover_delay_frames: u16 = look_preview_delay_frames, /// Where dumps go when `DumpDir` is unset; empty without a host /// filesystem. default_dump_dir: []const u8 = "", - native_images: bool, + native_images: bool = false, capabilities: Capabilities, state: *const Runtime, /// The `LocationsConfig` argument in effect, as it would be typed. @@ -1467,14 +1468,12 @@ pub const Runtime = struct { /// Each setting line reads as the command that would set it: the word, /// then the value you would type after it (a `# Word unsupported` - /// comment where this shell has no such setting). No colons, no units: `WindowOpacity 70` - /// is both what DumpConfig prints and what you write back. What is in - /// effect but set by no word follows, after a blank line. - pub fn writeReport(out: *std.Io.Writer, context: ReportContext) !void { + /// comment where this shell has no such setting). No colons, no units: + /// `WindowOpacity 70` is both what the root ctl and DumpConfig print and + /// what you write back. + pub fn writeSettings(out: *std.Io.Writer, context: ReportContext) !void { const state = context.state; - // TaglineSize is said wherever the shell sizes its tag, by its word - // or only at build time. - for (settings) |setting| if (!(if (setting.action == .tagline_size) context.capabilities.tagline_font_size else setting.enabled(context.capabilities))) + for (settings) |setting| if (!setting.enabled(context.capabilities)) try out.print("# {s} unsupported\n", .{setting.word}) else switch (setting.action) { .toggle => |field| { @@ -1538,10 +1537,16 @@ pub const Runtime = struct { .motion => try out.print("{s} {s}\n", .{ setting.word, @tagName(state.motion) }), }; if (context.locations.len > 0) try out.print("LocationsConfig {s}\n", .{context.locations}); + } - // In effect, and set by no word: each a `#` line, which runs as - // nothing (exec.executeFrom), so the report can be written back. + /// DumpConfig's: the settings, then what is in effect but set by no + /// word, after a blank line. + pub fn writeReport(out: *std.Io.Writer, context: ReportContext) !void { + try writeSettings(out, context); + // Each a `#` line, which runs as nothing (exec.executeFrom), so the + // report can be written back. try out.writeByte('\n'); + const state = context.state; try out.print("# Last shell spawned: {s}\n", .{shown(state.shell.effective.get())}); try out.print("# Shell change pending: {s}\n", .{onOff(state.shell.pending)}); if (find("Font").?.enabled(context.capabilities)) { @@ -1992,7 +1997,7 @@ pub const Runtime = struct { try writeReport(&out, defaults_context); const web_report = storage[0..out.end]; try std.testing.expect(std.mem.indexOf(u8, web_report, "PanelSlide unsupported\n") != null); - try std.testing.expect(std.mem.indexOf(u8, web_report, "TaglineSize 100\n") != null); + try std.testing.expect(std.mem.indexOf(u8, web_report, "# TaglineSize unsupported\n") != null); try std.testing.expect(std.mem.indexOf(u8, web_report, "# Tagline size: build-time only\n") != null); } }; |
