Set title as argv[0] for commands specified with `-e` (#9121)

I want to see #7932 get merged, so applied the latest proposed patch.

Will close if the original PR gets some traction, as I do _not_ know Zig
nor this project.

Co-authored-by: rhodes-b <59537185+rhodes-b@users.noreply.github.com>
pull/9139/head
Bruno BELANYI 2025-10-10 21:41:38 +01:00 committed by GitHub
parent ac2f040b31
commit 854c8e6975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -702,7 +702,22 @@ pub fn init(
.set_title,
.{ .title = title },
);
}
} else if (command) |cmd| switch (cmd) {
// If a user specifies a command it is appropriate to set the title as argv[0]
// we know in the case of a direct command it has been supplied by the user
.direct => |cmd_str| if (cmd_str.len != 0) {
_ = try rt_app.performAction(
.{ .surface = self },
.set_title,
.{ .title = cmd_str[0] },
);
},
// We won't set the title in the case the shell expands the command
// as that should typically be used to launch a shell which should
// set its own titles
.shell => {},
};
// We are no longer the first surface
app.first = false;