Make shell login use setup script

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion 2024-08-05 01:03:11 +02:00
parent 391f86f602
commit 1075c923ef
No known key found for this signature in database
GPG Key ID: 3E85EB44F610AD7F
1 changed files with 5 additions and 3 deletions

View File

@ -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);
}