summaryrefslogtreecommitdiff
path: root/src/config.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 18:24:18 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit5dbd21795f6c68bd3c10d409135970e3033364f3 (patch)
tree7dcea4712daa0dcd46e8b8438ca00b2001a4aed4 /src/config.zig
parentf41d0209f65237568c9f7d527d5989ac8921b74c (diff)
downloadpardes-5dbd21795f6c68bd3c10d409135970e3033364f3.tar.gz
pardes-5dbd21795f6c68bd3c10d409135970e3033364f3.zip
Motion flavours, and Lift is shadow, rim or auto: auto on a dark page recedes the other panes (InactiveDim)
Motion off|crisp|smooth|bouncy|playful is one parameter set (animation.Motion) every fx animation reads. One focus spring per pane drives both the lift and the dim, at the flavour's pace; a grid snaps. Lift drops glow and surface. A shadow falls on pane bodies and rails only, capped so text and the selection keep min(contrast, 4.5); rim is a hairline along the focused tag's top. auto is a shadow on a light page; on a dark page the core recedes the unfocused panes' text (InactiveDim, ported from 2e4d97f, default 30 under auto) with the same floor. Tests: focused text contrast is never below unfocused in any style, dim or theme; the focused pane's cells and tag are untouched by a dim. Shared files: src/config.zig, src/builtins.zig, src/ninep/ctl.zig, src/surface.zig, src/detached/wire.zig, docs/config.md, test/snapshots/builtins.snap (one more wheel for the longer help).
Diffstat (limited to 'src/config.zig')
-rw-r--r--src/config.zig50
1 files changed, 42 insertions, 8 deletions
diff --git a/src/config.zig b/src/config.zig
index f7e83e91..ed7bee92 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -116,6 +116,8 @@ pub const leader_path = paths: {
if (builtins.capabilities.window_blur) table.set(.WindowBlur, null);
if (builtins.capabilities.ligatures) table.set(.Ligatures, null);
if (builtins.capabilities.lift) table.set(.Lift, null);
+ table.set(.Motion, null);
+ table.set(.InactiveDim, null);
if (builtins.capabilities.panel_transitions) {
table.set(.PanelSlide, "as");
table.set(.PanelZoom, "az");
@@ -623,6 +625,13 @@ pub const Runtime = struct {
/// docs/render-pipeline.md ยง9.1), or off. Opt-in until the focus lift's
/// default is decided. Only a pixel shell draws it (`Capabilities.lift`).
lift: LiftStyle = .off,
+ /// Blends the unfocused panes' text toward each cell's own ground,
+ /// percent (0 off): the focused pane wins by comparison, its tag tint
+ /// untouched. Kept above min(each cell's contrast, 4.5).
+ inactive_dim: u8 = 0,
+ /// How the fx track's animations move (animation.Motion): off for
+ /// reduced motion.
+ motion: animation.Motion.Flavour = .smooth,
/// Builtins announce themselves on the message row.
verbose: bool = true,
@@ -670,12 +679,15 @@ pub const Runtime = struct {
pub const ShaderAnimation = enum { off, on, always };
- /// shadow: a soft drop shadow. surface: the lifted pane's ground
- /// lightens, as a raised surface does on a dark theme. rim: a soft light
- /// along its top and left edges. glow: a faint halo in the theme's
- /// accent. auto: shadow on a light page, surface and a faint rim on a
- /// dark one.
- pub const LiftStyle = enum(u8) { off, shadow, surface, rim, glow, auto };
+ /// shadow: a soft drop shadow. rim: a light hairline along the top of
+ /// the focused pane's tag rows. auto: a shadow on a light page; on a
+ /// dark one, where a shadow has nothing to darken, the other panes
+ /// recede instead (InactiveDim, at `auto_dim` unless it is set).
+ pub const LiftStyle = enum(u8) { off, shadow, rim, auto };
+ /// What `Lift auto` dims the unfocused panes by on a dark page when
+ /// InactiveDim is 0: enough to read at a glance (the user's own init
+ /// sets 35), not so much that they stop being worth reading.
+ pub const auto_dim: u8 = 30;
/// Each pass the bundled Crt or a Shadertoy file.
pub const Post = struct {
@@ -846,6 +858,10 @@ pub const Runtime = struct {
dump_dir,
/// A lift style, `on` (auto) or `off`; bare flips auto and off.
lift,
+ /// A motion flavour.
+ motion,
+ /// A percentage, 0 through 100.
+ inactive_dim,
transition: animation.Transition,
scene: Scene,
/// A Shadertoy file into the post chain or out of it; `off` empties
@@ -881,6 +897,8 @@ pub const Runtime = struct {
.{ .word = "MessageAnimation", .action = .{ .toggle = .message_animation } },
.{ .word = "Ligatures", .action = .{ .toggle = .ligatures }, .availability = .ligatures },
.{ .word = "Lift", .action = .lift, .availability = .lift },
+ .{ .word = "Motion", .action = .motion },
+ .{ .word = "InactiveDim", .action = .inactive_dim },
.{ .word = "MessageLinger", .action = .{ .message_ms = .linger } },
.{ .word = "MessageFall", .action = .{ .message_ms = .fall } },
.{ .word = "MessageDissolve", .action = .{ .message_ms = .dissolve } },
@@ -1074,6 +1092,16 @@ pub const Runtime = struct {
else
std.meta.stringToEnum(LiftStyle, text) orelse return false;
},
+ .motion => {
+ const text = std.mem.trim(u8, argument orelse return false, " \t\r\n");
+ state.motion = std.meta.stringToEnum(animation.Motion.Flavour, text) orelse return false;
+ },
+ .inactive_dim => {
+ const text = std.mem.trim(u8, argument orelse return false, " \t\r\n%");
+ const percent = std.fmt.parseInt(u8, text, 10) catch return false;
+ if (percent > 100) return false;
+ state.inactive_dim = percent;
+ },
.theme, .font => return false,
}
return true;
@@ -1247,6 +1275,8 @@ pub const Runtime = struct {
try out.print("{s} {s}\n", .{ setting.word, @tagName(state.lift) })
else
try out.print("{s} unsupported\n", .{setting.word}),
+ .motion => try out.print("{s} {s}\n", .{ setting.word, @tagName(state.motion) }),
+ .inactive_dim => try out.print("{s} {d}\n", .{ setting.word, state.inactive_dim }),
};
if (context.startup_config_path) |path|
@@ -1514,7 +1544,9 @@ pub const Runtime = struct {
.dump_dir => "~/dumps",
.shader => "~/crt.glsl",
.shader_animation => "always",
- .lift => "glow",
+ .lift => "rim",
+ .motion => "playful",
+ .inactive_dim => "35",
else => null,
};
try std.testing.expect(apply(&state, setting, argument));
@@ -1565,7 +1597,9 @@ pub const Runtime = struct {
},
.shader => "Shader ~/crt.glsl\n",
.shader_animation => "ShaderAnimation always\n",
- .lift => "Lift glow\n",
+ .lift => "Lift rim\n",
+ .motion => "Motion playful\n",
+ .inactive_dim => "InactiveDim 35\n",
.theme, .font => unreachable,
};
try std.testing.expect(std.mem.indexOf(u8, report, expected) != null);