diff --git a/cmd-split-window.c b/cmd-split-window.c index 97fa9ae3..77576901 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -38,11 +38,11 @@ const struct cmd_entry cmd_new_pane_entry = { .name = "new-pane", .alias = "newp", - .args = { "bc:de:EfF:hIkl:Lm:p:PR:s:S:t:vx:X:y:Y:Z", 0, -1, NULL }, + .args = { "bc:de:EfF:hIkl:Lm:p:PR:s:S:t:T:vx:X:y:Y:Z", 0, -1, NULL }, .usage = "[-bdefhIklPvZ] [-c start-directory] [-e environment] " "[-F format] [-l size] [-m message] [-p percentage] " "[-s style] [-S active-border-style] " - "[-R inactive-border-style] [-x width] [-y height] " + "[-R inactive-border-style] [-T title] [-x width] [-y height] " "[-X x-position] [-Y y-position] " CMD_TARGET_PANE_USAGE " " "[shell-command [argument ...]]", @@ -56,11 +56,11 @@ const struct cmd_entry cmd_split_window_entry = { .name = "split-window", .alias = "splitw", - .args = { "bc:de:EfF:hIkl:m:p:PR:s:S:t:vZ", 0, -1, NULL }, + .args = { "bc:de:EfF:hIkl:m:p:PR:s:S:t:T:vZ", 0, -1, NULL }, .usage = "[-bdefhIklPvZ] [-c start-directory] [-e environment] " "[-F format] [-l size] [-m message] [-p percentage] " "[-s style] [-S active-border-style] " - "[-R inactive-border-style] " CMD_TARGET_PANE_USAGE " " + "[-R inactive-border-style] [-T title] " CMD_TARGET_PANE_USAGE " " "[shell-command [argument ...]]", .target = { 't', CMD_FIND_PANE, 0 }, @@ -85,7 +85,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) struct cmd_find_state fs; int input, empty, is_floating, flags = 0; const char *template, *style; - char *cause = NULL, *cp; + char *cause = NULL, *cp, *title; struct args_value *av; u_int count = args_count(args); @@ -194,6 +194,12 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) "remain-on-exit-format", 0, "%s", args_get(args, 'm')); } + if (args_has(args, 'T')) { + title = format_single_from_target(item, args_get(args, 'T')); + screen_set_title(&new_wp->base, title); + notify_pane("pane-title-changed", new_wp); + free(title); + } if (input) { switch (window_pane_start_input(new_wp, item, &cause)) { diff --git a/tmux.1 b/tmux.1 index f0dafb1a..d0487393 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3341,6 +3341,7 @@ but a different format may be specified with .Op Fl s Ar style .Op Fl S Ar active\-border\-style .Op Fl t Ar target\-pane +.Op Fl T Ar title .Op Ar shell\-command Op Ar argument ... .Xc .D1 Pq alias: Ic newp @@ -3359,6 +3360,8 @@ sets the border style when the pane is active and .Fl R sets the border style when the pane is inactive (see .Sx STYLES ) . +.Fl T +sets the pane title. .Pp .Fl h does a horizontal split and @@ -3756,6 +3759,7 @@ the command behaves like .Op Fl s Ar style .Op Fl S Ar active\-border\-style .Op Fl t Ar target\-pane +.Op Fl T Ar title .Op Ar shell\-command Op Ar argument ... .Xc .D1 Pq alias: Ic splitw