summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-07-10 05:50:55 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-07-10 05:50:55 +0000
commit68a0f9c7c08774fdd34a259e91c1d9898cc73262 (patch)
tree4fe4baed01bdd3055c9bb6b24d5ad56cb57b6058 /usr.bin
parent027f5fa01a6342a349399eafe782c76d0edcd7dc (diff)
Add a default-terminal option to set the starting value of $TERM in new
windows. This is "screen" by default and must be either that or something closely related. This does makes it easier to customise it if necessary.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-set-option.c3
-rw-r--r--usr.bin/tmux/server-fn.c10
-rw-r--r--usr.bin/tmux/tmux.114
-rw-r--r--usr.bin/tmux/tmux.c3
-rw-r--r--usr.bin/tmux/tmux.h4
5 files changed, 26 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index 41d5201247a..98348a5ead4 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.3 2009/07/07 19:49:19 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.4 2009/07/10 05:50:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -53,6 +53,7 @@ const struct set_option_entry set_option_table[NSETOPTION] = {
{ "buffer-limit", SET_OPTION_NUMBER, 1, INT_MAX, NULL },
{ "default-command", SET_OPTION_STRING, 0, 0, NULL },
{ "default-path", SET_OPTION_STRING, 0, 0, NULL },
+ { "default-terminal", SET_OPTION_STRING, 0, 0, NULL },
{ "display-time", SET_OPTION_NUMBER, 1, INT_MAX, NULL },
{ "history-limit", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
{ "lock-after-time", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index e6003d98607..2226b7ccf97 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.3 2009/06/30 13:40:30 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.4 2009/07/10 05:50:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,8 +29,8 @@ int server_lock_callback(void *, const char *);
const char **
server_fill_environ(struct session *s)
{
- static const char *env[] = { NULL /* TMUX= */, "TERM=screen", NULL };
- static char tmuxvar[MAXPATHLEN + 256];
+ static const char *env[] = { NULL /* TMUX= */, NULL /* TERM */, NULL };
+ static char tmuxvar[MAXPATHLEN + 256], termvar[256];
u_int idx;
if (session_index(s, &idx) != 0)
@@ -40,6 +40,10 @@ server_fill_environ(struct session *s)
"TMUX=%s,%ld,%u", socket_path, (long) getpid(), idx);
env[0] = tmuxvar;
+ xsnprintf(termvar, sizeof termvar,
+ "TERM=%s", options_get_string(&s->options, "default-terminal"));
+ env[1] = termvar;
+
return (env);
}
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 65ec37b47e9..76eff916dd2 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.21 2009/07/10 05:43:01 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.22 2009/07/10 05:50:54 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -1090,6 +1090,18 @@ environment variable or, if it is unset, the user's shell returned by
Set the default working directory for processes created from keys, or
interactively from the prompt.
The default is the current working directory when the server is started.
+.It Ic default-terminal Ar terminal
+Set the default terminal for new windows created in this session - the
+default value of the
+.Ev TERM
+environment variable.
+For
+.Nm
+to work correctly, this
+.Em must
+be set to
+.Ql screen
+or a derivative of it.
.It Ic display-time Ar time
Set the amount of time for which status line messages are displayed.
.Ar time
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 8f8964c71e9..e4035fc45ae 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.13 2009/07/08 05:26:45 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.14 2009/07/10 05:50:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -270,6 +270,7 @@ main(int argc, char **argv)
options_set_number(&global_s_options, "bell-action", BELL_ANY);
options_set_number(&global_s_options, "buffer-limit", 9);
options_set_string(&global_s_options, "default-command", "%s", "");
+ options_set_string(&global_s_options, "default-terminal", "screen");
options_set_number(&global_s_options, "display-time", 750);
options_set_number(&global_s_options, "history-limit", 2000);
options_set_number(&global_s_options, "lock-after-time", 0);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 2b58c031899..c75750a2aa2 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.19 2009/07/09 15:47:49 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.20 2009/07/10 05:50:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -935,7 +935,7 @@ struct set_option_entry {
};
extern const struct set_option_entry set_option_table[];
extern const struct set_option_entry set_window_option_table[];
-#define NSETOPTION 25
+#define NSETOPTION 26
#define NSETWINDOWOPTION 19
/* tmux.c */