summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 02:23:59 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit45a66bd1c062a5cf4d63b1df68e050b059cdfa1d (patch)
tree3c6ecbd21dd2d07c624b8799defc31d94d51a256 /src
parent90f5c414a90afec978c8c0add58fd2a7e29acbaa (diff)
downloadpardes-45a66bd1c062a5cf4d63b1df68e050b059cdfa1d.tar.gz
pardes-45a66bd1c062a5cf4d63b1df68e050b059cdfa1d.zip
The default Shell is $SHELL, else /bin/sh
With no Shell set, pardes ran fish, which a box may not have and a user may not use. The default is now the user's login shell ($SHELL), else /bin/sh; an explicit Shell still overrides it. The tests pin their own shell (snapshots bash, the python suites /bin/sh or bash) and pass with SHELL unset; the Config report and docs say where the default comes from. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/Output.zig2
-rw-r--r--src/builtins.zig2
-rw-r--r--src/config.zig14
-rw-r--r--src/ninep/ctl.zig2
-rw-r--r--src/pardes.zig2
5 files changed, 15 insertions, 7 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 2f462fd1..ee932768 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -665,7 +665,7 @@ pub fn openConfig(p: *Pardes, id: usize) !void {
.startup_config_path = p.opts.startup_config_path,
.platform = @tagName(pardes.platform),
.theme_name = p.theme().name,
- .compiled_default_shell = config.default_shell,
+ .compiled_default_shell = config.defaultShell(),
.gui_shader_source_mode = if (gui_shader_source_mode) |mode|
mode.label()
else
diff --git a/src/builtins.zig b/src/builtins.zig
index 8c6228c0..f7104a8c 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -399,7 +399,7 @@ test "Ligatures is a setting only in the shell that shapes text" {
.startup_config_path = null,
.platform = @tagName(pardes.platform),
.theme_name = p.theme().name,
- .compiled_default_shell = config.default_shell,
+ .compiled_default_shell = config.defaultShell(),
.hover_delay_frames = null,
.native_images = false,
.capabilities = capabilities,
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",
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 8a35c381..0ab63fbb 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -399,7 +399,7 @@ pub fn writeSettingsOf(p: *Pardes, s: *const config.Runtime, w: *std.Io.Writer)
.theme => try w.print("{s} {s}\n", .{ word, if (s == &p.settings) p.theme().name else pardes.themes[s.theme].name }),
.shell => {
const chosen = s.shell.requested.get();
- try w.print("{s} {s}\n", .{ word, if (chosen.len > 0) chosen else config.default_shell });
+ try w.print("{s} {s}\n", .{ word, if (chosen.len > 0) chosen else config.defaultShell() });
},
.font => {
const requested = s.font.requested_name.get();
diff --git a/src/pardes.zig b/src/pardes.zig
index a0b11566..f2791e33 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -4925,7 +4925,7 @@ pub const Pardes = struct {
pub fn shellBin(p: *const Pardes) []const u8 {
const selected = p.settings.shell.requested.get();
- return if (selected.len == 0) config.default_shell else selected;
+ return if (selected.len == 0) config.defaultShell() else selected;
}
pub fn acknowledgeShell(p: *Pardes, id: usize, executable: []const u8, prompt_marks: bool) void {