diff --git a/format.c b/format.c index ed29f575..5ea9d1bc 100644 --- a/format.c +++ b/format.c @@ -1119,20 +1119,25 @@ format_defaults_client(struct format_tree *ft, struct client *c) { struct session *s; const char *name; + struct tty *tty = &c->tty; + const char *types[] = TTY_TYPES; if (ft->s == NULL) ft->s = c->session; format_add(ft, "client_pid", "%ld", (long) c->pid); - format_add(ft, "client_height", "%u", c->tty.sy); - format_add(ft, "client_width", "%u", c->tty.sx); - if (c->tty.path != NULL) - format_add(ft, "client_tty", "%s", c->tty.path); - if (c->tty.termname != NULL) - format_add(ft, "client_termname", "%s", c->tty.termname); + format_add(ft, "client_height", "%u", tty->sy); + format_add(ft, "client_width", "%u", tty->sx); + if (tty->path != NULL) + format_add(ft, "client_tty", "%s", tty->path); format_add(ft, "client_control_mode", "%d", !!(c->flags & CLIENT_CONTROL)); + if (tty->term_name != NULL) + format_add(ft, "client_termname", "%s", tty->term_name); + if (tty->term_name != NULL) + format_add(ft, "client_termtype", "%s", types[tty->term_type]); + format_add_tv(ft, "client_created", &c->creation_time); format_add_tv(ft, "client_activity", &c->activity_time); @@ -1143,7 +1148,7 @@ format_defaults_client(struct format_tree *ft, struct client *c) format_add(ft, "client_prefix", "%d", 1); format_add(ft, "client_key_table", "%s", c->keytable->name); - if (c->tty.flags & TTY_UTF8) + if (tty->flags & TTY_UTF8) format_add(ft, "client_utf8", "%d", 1); else format_add(ft, "client_utf8", "%d", 0); diff --git a/tmux.1 b/tmux.1 index aac3ca43..4bc82cd8 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3512,6 +3512,7 @@ The following variables are available, where appropriate: .It Li "client_readonly" Ta "" Ta "1 if client is readonly" .It Li "client_session" Ta "" Ta "Name of the client's session" .It Li "client_termname" Ta "" Ta "Terminal name of client" +.It Li "client_termtype" Ta "" Ta "Terminal type of client" .It Li "client_tty" Ta "" Ta "Pseudo terminal of client" .It Li "client_utf8" Ta "" Ta "1 if client supports utf8" .It Li "client_width" Ta "" Ta "Width of client" diff --git a/tmux.h b/tmux.h index 66b8d3af..3108f81e 100644 --- a/tmux.h +++ b/tmux.h @@ -1112,9 +1112,6 @@ struct tty { u_int rleft; u_int rright; - char *termname; - struct tty_term *term; - int fd; struct bufferevent *event; @@ -1131,6 +1128,8 @@ struct tty { #define TTY_FOCUS 0x40 int flags; + struct tty_term *term; + char *term_name; int term_flags; enum { TTY_VT100, diff --git a/tty.c b/tty.c index 3892df6d..23a74255 100644 --- a/tty.c +++ b/tty.c @@ -105,9 +105,9 @@ tty_init(struct tty *tty, struct client *c, int fd, char *term) memset(tty, 0, sizeof *tty); if (term == NULL || *term == '\0') - tty->termname = xstrdup("unknown"); + tty->term_name = xstrdup("unknown"); else - tty->termname = xstrdup(term); + tty->term_name = xstrdup(term); tty->fd = fd; tty->client = c; @@ -177,7 +177,7 @@ tty_set_size(struct tty *tty, u_int sx, u_int sy) int tty_open(struct tty *tty, char **cause) { - tty->term = tty_term_find(tty->termname, tty->fd, cause); + tty->term = tty_term_find(tty->term_name, tty->fd, cause); if (tty->term == NULL) { tty_close(tty); return (-1); @@ -364,7 +364,7 @@ tty_free(struct tty *tty) free(tty->ccolour); free(tty->path); - free(tty->termname); + free(tty->term_name); } void