Add client_session and client_last_session formats.

This commit is contained in:
Nicholas Marriott 2013-03-22 10:32:36 +00:00
parent 8d59b189cc
commit ad760b3bf7
2 changed files with 12 additions and 2 deletions

View File

@ -303,6 +303,7 @@ format_client(struct format_tree *ft, struct client *c)
{ {
char *tim; char *tim;
time_t t; time_t t;
struct session *s;
format_add(ft, "client_cwd", "%s", c->cwd); format_add(ft, "client_cwd", "%s", c->cwd);
format_add(ft, "client_height", "%u", c->tty.sy); format_add(ft, "client_height", "%u", c->tty.sy);
@ -333,6 +334,13 @@ format_client(struct format_tree *ft, struct client *c)
format_add(ft, "client_readonly", "%d", 1); format_add(ft, "client_readonly", "%d", 1);
else else
format_add(ft, "client_readonly", "%d", 0); format_add(ft, "client_readonly", "%d", 0);
s = c->session;
if (s != NULL)
format_add(ft, "client_session", "%s", s->name);
s = c->last_session;
if (s != NULL && session_alive(s))
format_add(ft, "client_last_session", "%s", s->name);
} }
/* Set default format keys for a winlink. */ /* Set default format keys for a winlink. */

2
tmux.1
View File

@ -2964,8 +2964,10 @@ The following variables are available, where appropriate:
.It Li "client_created_string" Ta "String time client created" .It Li "client_created_string" Ta "String time client created"
.It Li "client_cwd" Ta "Working directory of client" .It Li "client_cwd" Ta "Working directory of client"
.It Li "client_height" Ta "Height of client" .It Li "client_height" Ta "Height of client"
.It Li "client_last_session" Ta "Name of the client's last session"
.It Li "client_prefix" Ta "1 if prefix key has been pressed" .It Li "client_prefix" Ta "1 if prefix key has been pressed"
.It Li "client_readonly" Ta "1 if client is readonly" .It Li "client_readonly" Ta "1 if client is readonly"
.It Li "client_session" Ta "Name of the client's session"
.It Li "client_termname" Ta "Terminal name of client" .It Li "client_termname" Ta "Terminal name of client"
.It Li "client_tty" Ta "Pseudo terminal of client" .It Li "client_tty" Ta "Pseudo terminal of client"
.It Li "client_utf8" Ta "1 if client supports utf8" .It Li "client_utf8" Ta "1 if client supports utf8"