From 9dd72b958366c44b6d62680836983c58d2a0a42f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 10 Oct 2009 10:02:48 +0000 Subject: Add "grouped sessions" which have independent name, options, current window and so on but where the linked windows are synchronized (ie creating, killing windows and so on are mirrored between the sessions). A grouped session may be created by passing -t to new-session. Had this around for a while, tested by a couple of people. --- cmd-list-sessions.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'cmd-list-sessions.c') diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 95c26567..cfa1433b 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -42,23 +42,32 @@ const struct cmd_entry cmd_list_sessions_entry = { int cmd_list_sessions_exec(unused struct cmd *self, struct cmd_ctx *ctx) { - struct session *s; - char *tim; - u_int i; - time_t t; + struct session *s; + struct session_group *sg; + char *tim, tmp[64]; + u_int i, idx; + time_t t; for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { s = ARRAY_ITEM(&sessions, i); if (s == NULL) continue; + sg = session_group_find(s); + if (sg == NULL) + *tmp = '\0'; + else { + idx = session_group_index(sg); + xsnprintf(tmp, sizeof tmp, " (group %u)", idx); + } + t = s->tv.tv_sec; tim = ctime(&t); *strchr(tim, '\n') = '\0'; - ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s", + ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s%s", s->name, winlink_count(&s->windows), tim, s->sx, s->sy, - s->flags & SESSION_UNATTACHED ? "" : " (attached)"); + tmp, s->flags & SESSION_UNATTACHED ? "" : " (attached)"); } return (0); -- cgit v1.2.3