summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno BELANYI <bruno@belanyi.fr>2025-10-10 21:41:38 +0100
committerGitHub <noreply@github.com>2025-10-10 13:41:38 -0700
commit854c8e6975806c86765dbc2af5222d07cf28e3d7 (patch)
treee293e11b360a260a42fd34c197ca4dd139441d0f
parentac2f040b3140f4a77353d0c5f63909b36835a337 (diff)
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>
-rw-r--r--src/Surface.zig17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Surface.zig b/src/Surface.zig
index b1553edff..82d6615b6 100644
--- a/src/Surface.zig
+++ b/src/Surface.zig
@@ -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;