From 7d5e4947160d9355353c29a983e373b66c05abef Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 1 Sep 2009 13:09:49 +0000 Subject: When using tmux as a login shell, there is currently no way to specify a shell to be used as a login shell inside tmux, so add a default-shell session option. This sets the shell invoked as a login shell when the default-command option is empty. The default option value is whichever of $SHELL, getpwuid(getuid())'s pw_shell or /bin/sh is valid first. Based on a diff from martynas@, changed by me to be a session option rather than a window option. --- cmd-split-window.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cmd-split-window.c') diff --git a/cmd-split-window.c b/cmd-split-window.c index d5f0ba6c..d6fc3f78 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -18,6 +18,7 @@ #include +#include #include #include @@ -151,6 +152,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct window_pane *wp; struct environ env; char *cmd, *cwd, *cause; + const char *shell; u_int hlimit; int size; enum layout_type type; @@ -183,8 +185,12 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) if (data->flag_horizontal) type = LAYOUT_LEFTRIGHT; + shell = options_get_string(&s->options, "default-shell"); + if (*shell == '\0' || areshell(shell)) + shell = _PATH_BSHELL; + wp = window_add_pane(w, hlimit); - if (window_pane_spawn(wp, cmd, cwd, &env, &s->tio, &cause) != 0) + if (window_pane_spawn(wp, cmd, shell, cwd, &env, &s->tio, &cause) != 0) goto error; if (layout_split_pane(w->active, type, size, wp) != 0) { cause = xstrdup("pane too small"); -- cgit