mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-19 01:46:33 +02:00
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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user