summaryrefslogtreecommitdiff
path: root/src/config.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.zig')
-rw-r--r--src/config.zig35
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);
}
};