Add window-default-command option to override default-command per

window, from Meriel Sartha Mittelbach.
This commit is contained in:
nicm
2026-10-07 12:55:41 +00:00
committed by tmux update bot
parent e63e2df764
commit d041d56bb2
3 changed files with 22 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: options-table.c,v 1.249 2026/10/05 09:03:11 nicm Exp $ */ /* $OpenBSD: options-table.c,v 1.250 2026/10/07 12:55:41 nicm Exp $ */
/* /*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1778,6 +1778,14 @@ const struct options_table_entry options_table[] = {
.text = "Default style of the active pane." .text = "Default style of the active pane."
}, },
{ .name = "window-default-command",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "",
.text = "Default command to run in new panes. If set, "
"overrides 'default-command'."
},
{ .name = "window-pane-current-status-format", { .name = "window-pane-current-status-format",
.type = OPTIONS_TABLE_STRING, .type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW, .scope = OPTIONS_TABLE_WINDOW,

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: spawn.c,v 1.54 2026/10/02 13:20:42 nicm Exp $ */ /* $OpenBSD: spawn.c,v 1.55 2026/10/07 12:55:41 nicm Exp $ */
/* /*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -379,7 +379,9 @@ spawn_pane(struct spawn_context *sc, char **cause)
* directory. * directory.
*/ */
if (sc->argc == 0 && (~sc->flags & SPAWN_RESPAWN)) { if (sc->argc == 0 && (~sc->flags & SPAWN_RESPAWN)) {
cmd = options_get_string(s->options, "default-command"); cmd = options_get_string(w->options, "window-default-command");
if (cmd == NULL || *cmd == '\0')
cmd = options_get_string(s->options, "default-command");
if (cmd != NULL && *cmd != '\0') { if (cmd != NULL && *cmd != '\0') {
argc = 1; argc = 1;
argv = (char **)&cmd; argv = (char **)&cmd;

11
tmux.1
View File

@@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.1177 2026/10/06 17:45:26 schwarze Exp $ .\" $OpenBSD: tmux.1,v 1.1178 2026/10/07 12:55:41 nicm Exp $
.\" .\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\" .\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: October 6 2026 $ .Dd $Mdocdate: October 7 2026 $
.Dt TMUX 1 .Dt TMUX 1
.Os .Os
.Sh NAME .Sh NAME
@@ -3619,6 +3619,8 @@ is the command to execute.
If If
.Ar shell\-command .Ar shell\-command
is not specified, the value of the is not specified, the value of the
.Ic window\-default\-command
or
.Ic default\-command .Ic default\-command
option is used. option is used.
.Fl c .Fl c
@@ -6179,6 +6181,11 @@ see the
.Sx STYLES .Sx STYLES
section. section.
.Pp .Pp
.It Ic window\-default\-command Ar shell\-command
Per-window version of the
.Ic default\-command
option.
.Pp
.It Ic window\-status\-activity\-style Ar style .It Ic window\-status\-activity\-style Ar style
Set status line style for windows with an activity alert. Set status line style for windows with an activity alert.
For how to specify For how to specify