diff options
Diffstat (limited to 'src/config.zig')
| -rw-r--r-- | src/config.zig | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/config.zig b/src/config.zig index 46a5f7c3..dbe4e9b7 100644 --- a/src/config.zig +++ b/src/config.zig @@ -171,6 +171,7 @@ pub const leader_path = paths: { table.set(.ProgramEsc, null); table.set(.Motion, null); if (builtins.capabilities.lift) table.set(.GripWidth, null); + table.set(.InactiveDim, null); if (builtins.capabilities.lift) table.set(.Pet, null); if (builtins.TreeContext.enabled) table.set(.TreeContext, null); table.set(.ThemeFile, null); @@ -707,6 +708,11 @@ pub const Runtime = struct { /// A font's programming ligatures (`->`, `!=`) draw across their cells. /// Only a shell that shapes text has the setting (`Capabilities.ligatures`). ligatures: bool = true, + /// How far the unfocused panes' text fades toward its ground, a percent + /// (0 off), kept above the pair's own contrast or 4.5, whichever is + /// lower: a setting alone, which the window draws (gui.zig's Dim) and a + /// terminal keeps. + inactive_dim: u8 = 0, /// The grip's button and the scrollbar under it, one width, as a percent /// of the theme's `rail_px` (acme's 12px Scrollwid at a 17px tagline): /// a pixel shell's (docs/typ/themes.typ). @@ -890,6 +896,8 @@ pub const Runtime = struct { dump_dir, /// A motion flavour. motion, + /// A percentage, 0 through 100. + inactive_dim, grip_width, tab, callstack_depth, @@ -947,6 +955,7 @@ pub const Runtime = struct { .{ .word = "ProgramEsc", .action = .{ .toggle = .program_esc }, .doc = "In a raw terminal, Esc goes to the program and Shift-Esc backs out, on; off (the default) swaps them." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "GripWidth", .action = .grip_width, .doc = "The grip and scrollbar width, as a percent of the theme's rail." }, + .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, .{ .word = "Pet", .action = .{ .choice = .pet }, .doc = "The window's companion in the workspace tag's blank space: off, cat or frog." }, .{ .word = "MessageLinger", .action = .{ .message_ms = .linger }, .doc = "How long, in milliseconds, a message stays after what dismisses it." }, .{ .word = "MessageFall", .action = .{ .message_ms = .fall }, .doc = "How long, in milliseconds, a message takes to fall into its row." }, @@ -1050,6 +1059,7 @@ pub const Runtime = struct { }, }, .motion => state.motion = stepped(animation.Motion.Flavour, state.motion, argument) orelse return false, + .inactive_dim => state.inactive_dim = number(u8, argument, " \t\r\n%", 0, 100) orelse return false, .grip_width => state.grip_width = number(u16, argument, " \t\r\n%", 50, 300) orelse return false, .callstack_depth => state.callstack_depth = number(u8, argument, " \t\r\n", 1, @import("lsp/lsp.zig").callstack_max_depth) orelse return false, .tab => state.tab = number(u16, argument, " \t\r\n", 1, 16) orelse return false, @@ -1084,7 +1094,7 @@ pub const Runtime = struct { /// words (`choices`), else its range or the kind of thing it takes. pub fn takes(action: Action) ?[]const u8 { return choices(action) orelse switch (action) { - .window_opacity, .window_blur => "0-100 (a percentage)", + .inactive_dim, .window_opacity, .window_blur => "0-100 (a percentage)", .grip_width => "50-300 (a percentage)", .tab => "1-16 (cells)", .callstack_depth => "1-64 (levels)", @@ -1178,7 +1188,7 @@ pub const Runtime = struct { else try out.print("{s} {s}\n", .{ setting.word, context.theme_name }), // A number in a field named as its action. - inline .window_opacity, .window_blur, .callstack_depth, .tab, .search_rows, .grip_width => |_, tag| try out.print("{s} {d}\n", .{ setting.word, @field(state, @tagName(tag)) }), + inline .window_opacity, .window_blur, .inactive_dim, .callstack_depth, .tab, .search_rows, .grip_width => |_, tag| try out.print("{s} {d}\n", .{ setting.word, @field(state, @tagName(tag)) }), .dump_dir => { const dir = if (state.dump_dir.len > 0) state.dump_dir.get() else context.default_dump_dir; if (dir.len > 0) try out.print("{s} {s}\n", .{ setting.word, dir }) else try out.print("# {s} (none)\n", .{setting.word}); @@ -1386,8 +1396,8 @@ pub const Runtime = struct { .{ "MessageLinger", "1500" }, .{ "MessageFall", "1500" }, .{ "MessageDissolve", "1500" }, .{ "DumpDir", "~/dumps" }, .{ "TermImages", "petscii" }, .{ "JumpScope", "all" }, .{ "SearchPlace", "column" }, .{ "SearchPane", "new" }, .{ "Motion", "playful" }, - .{ "GripWidth", "200" }, .{ "CallstackDepth", "16" }, .{ "Tab", "8" }, - .{ "SearchRows", "12" }, + .{ "GripWidth", "200" }, .{ "InactiveDim", "35" }, .{ "CallstackDepth", "16" }, + .{ "Tab", "8" }, .{ "SearchRows", "12" }, }; for (values) |v| try std.testing.expect(apply(&state, find(v[0]).?, v[1])); try std.testing.expect(state.font.requested_name.set("Wanted Mono")); |
