mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-26 18:13:10 +01:00
Make session_attached a count and add session_many_attached flag.
This commit is contained in:
parent
9368914ee7
commit
b11de5adc7
6
format.c
6
format.c
@ -401,10 +401,8 @@ format_session(struct format_tree *ft, struct session *s)
|
|||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
format_add(ft, "session_created_string", "%s", tim);
|
format_add(ft, "session_created_string", "%s", tim);
|
||||||
|
|
||||||
if (s->flags & SESSION_UNATTACHED)
|
format_add(ft, "session_attached", "%u", s->attached);
|
||||||
format_add(ft, "session_attached", "%d", 0);
|
format_add(ft, "session_many_attached", "%u", s->attached > 1);
|
||||||
else
|
|
||||||
format_add(ft, "session_attached", "%d", 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set default format keys for a client. */
|
/* Set default format keys for a client. */
|
||||||
|
2
resize.c
2
resize.c
@ -55,6 +55,7 @@ recalculate_sizes(void)
|
|||||||
RB_FOREACH(s, sessions, &sessions) {
|
RB_FOREACH(s, sessions, &sessions) {
|
||||||
has_status = options_get_number(&s->options, "status");
|
has_status = options_get_number(&s->options, "status");
|
||||||
|
|
||||||
|
s->attached = 0;
|
||||||
ssx = ssy = UINT_MAX;
|
ssx = ssy = UINT_MAX;
|
||||||
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
||||||
c = ARRAY_ITEM(&clients, j);
|
c = ARRAY_ITEM(&clients, j);
|
||||||
@ -69,6 +70,7 @@ recalculate_sizes(void)
|
|||||||
ssy = c->tty.sy - 1;
|
ssy = c->tty.sy - 1;
|
||||||
else if (c->tty.sy < ssy)
|
else if (c->tty.sy < ssy)
|
||||||
ssy = c->tty.sy;
|
ssy = c->tty.sy;
|
||||||
|
s->attached++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssx == UINT_MAX || ssy == UINT_MAX) {
|
if (ssx == UINT_MAX || ssy == UINT_MAX) {
|
||||||
|
3
tmux.1
3
tmux.1
@ -3136,13 +3136,14 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane"
|
.It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane"
|
||||||
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
|
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
|
||||||
.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
|
.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
|
||||||
.It Li "session_attached" Ta "" Ta "1 if session attached"
|
.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
|
||||||
.It Li "session_created" Ta "" Ta "Integer time session created"
|
.It Li "session_created" Ta "" Ta "Integer time session created"
|
||||||
.It Li "session_created_string" Ta "" Ta "String time session created"
|
.It Li "session_created_string" Ta "" Ta "String time session created"
|
||||||
.It Li "session_group" Ta "" Ta "Number of session group"
|
.It Li "session_group" Ta "" Ta "Number of session group"
|
||||||
.It Li "session_grouped" Ta "" Ta "1 if session in a group"
|
.It Li "session_grouped" Ta "" Ta "1 if session in a group"
|
||||||
.It Li "session_height" Ta "" Ta "Height of session"
|
.It Li "session_height" Ta "" Ta "Height of session"
|
||||||
.It Li "session_id" Ta "" Ta "Unique session ID"
|
.It Li "session_id" Ta "" Ta "Unique session ID"
|
||||||
|
.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
|
||||||
.It Li "session_name" Ta "#S" Ta "Name of session"
|
.It Li "session_name" Ta "#S" Ta "Name of session"
|
||||||
.It Li "session_width" Ta "" Ta "Width of session"
|
.It Li "session_width" Ta "" Ta "Width of session"
|
||||||
.It Li "session_windows" Ta "" Ta "Number of windows in session"
|
.It Li "session_windows" Ta "" Ta "Number of windows in session"
|
||||||
|
2
tmux.h
2
tmux.h
@ -1086,6 +1086,8 @@ struct session {
|
|||||||
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
|
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
u_int attached;
|
||||||
|
|
||||||
struct termios *tio;
|
struct termios *tio;
|
||||||
|
|
||||||
struct environ environ;
|
struct environ environ;
|
||||||
|
Loading…
Reference in New Issue
Block a user