From 1075c923efa4e52bbaf3e9014f3e389b232900bf Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Mon, 5 Aug 2024 01:03:11 +0200 Subject: [PATCH] Make shell login use setup script Signed-off-by: AnErrupTion --- src/auth.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/auth.zig b/src/auth.zig index 1abc39c..f2bcb97 100644 --- a/src/auth.zig +++ b/src/auth.zig @@ -157,7 +157,7 @@ fn startSession( switch (current_environment.display_server) { .wayland => try executeWaylandCmd(pwd.pw_shell.?, config.setup_cmd, current_environment.cmd), - .shell => try executeShellCmd(pwd.pw_shell.?), + .shell => try executeShellCmd(pwd.pw_shell.?, config.setup_cmd), .xinitrc, .x11 => if (build_options.enable_x11_support) { var vt_buf: [5]u8 = undefined; const vt = try std.fmt.bufPrint(&vt_buf, "vt{d}", .{config.tty}); @@ -372,8 +372,10 @@ fn xauth(display_name: [:0]u8, shell: [*:0]const u8, pw_dir: [*:0]const u8, xaut if (status.status != 0) return error.XauthFailed; } -fn executeShellCmd(shell: [*:0]const u8) !void { - const args = [_:null]?[*:0]const u8{shell}; +fn executeShellCmd(shell: [*:0]const u8, setup_cmd: []const u8) !void { + var cmd_buffer: [1024]u8 = undefined; + const cmd_str = try std.fmt.bufPrintZ(&cmd_buffer, "{s} {s}", .{ setup_cmd, shell }); + const args = [_:null]?[*:0]const u8{ shell, "-c", cmd_str }; return std.posix.execveZ(shell, &args, std.c.environ); }