From d6d6e4d94b0929106fcf6e83ad476b44b9ce8b36 Mon Sep 17 00:00:00 2001 From: rhodes-b <59537185+rhodes-b@users.noreply.github.com> Date: Sun, 13 Jul 2025 19:21:30 -0500 Subject: [PATCH] set title as argv[0] for commands specified with `-e` --- src/Surface.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Surface.zig b/src/Surface.zig index af0a742c6..76c353969 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -675,6 +675,22 @@ pub fn init( .set_title, .{ .title = title }, ); + } else if (config.@"initial-command") |initial_command| { + switch (initial_command) { + // If a user specifies a command with `-e` it is appropriate to set the title + // as argv[0] + .direct => { + _ = try rt_app.performAction( + .{ .surface = self }, + .set_title, + .{ .title = initial_command.direct[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