diff options
Diffstat (limited to 'src/config.zig')
| -rw-r--r-- | src/config.zig | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/config.zig b/src/config.zig index fb38e4dd..a59fe18d 100644 --- a/src/config.zig +++ b/src/config.zig @@ -345,7 +345,15 @@ test "wheel drift guard" { try std.testing.expect(wheelTick(&g, false)); } -pub const default_shell = "fish"; +/// The shell when no `Shell` is set: the user's login shell ($SHELL), as a +/// terminal would start, else /bin/sh. An explicit `Shell` overrides it. +pub fn defaultShell() []const u8 { + if (comptime pardes.hosted) if (std.c.getenv("SHELL")) |s| { + const shell = std.mem.span(s); + if (shell.len > 0) return shell; + }; + return "/bin/sh"; +} // Minimum file gutter width, including the space after the line number. pub const PREFIX_W: u16 = 5; @@ -1364,7 +1372,7 @@ pub const Runtime = struct { try out.writeAll("Startup config: no per-user config path\n"); try out.print( "Platform: {s}\n" ++ - "Compiled default shell: {s}\n", + "Default shell ($SHELL, else /bin/sh): {s}\n", .{ context.platform, context.compiled_default_shell }, ); if (context.gui_shader_source_mode) |mode| @@ -1719,7 +1727,7 @@ pub const Runtime = struct { "TaglineSize 82\n", "Startup config: /tmp/pardes/init\n", "Platform: gui\n", - "Compiled default shell: /bin/sh\n", + "Default shell ($SHELL, else /bin/sh): /bin/sh\n", "GUI shader source: live GLSL compiled during this build\n", "Look hover delay: 18 frames\n", "Native images: on\n", |
